Merge ~santoshbit2007/oxide:scrollbar_work into oxide:master
- Git
- lp:~santoshbit2007/oxide
- scrollbar_work
- Merge into master
Proposed by
Santosh
Status: | Needs review |
---|---|
Proposed branch: | ~santoshbit2007/oxide:scrollbar_work |
Merge into: | oxide:master |
Diff against target: |
368 lines (+195/-3) 10 files modified
shared/BUILD.gn (+4/-0) shared/browser/oxide_content_browser_client.cc (+6/-1) shared/browser/scrollbar_type.cc (+37/-0) shared/browser/scrollbar_type.h (+27/-0) shared/browser/web_contents_helper.cc (+9/-0) shared/common/oxide_messages.h (+2/-0) shared/renderer/oxide_content_renderer_client.cc (+7/-2) shared/renderer/oxide_content_renderer_client.h (+2/-0) shared/renderer/oxide_scrollbar_state.cc (+54/-0) shared/renderer/oxide_scrollbar_state.h (+47/-0) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Chris Coulson | Needs Fixing | ||
Review via email:
|
Commit message
Description of the change
Implement scrollbar switch when shell mode is changed.
When shell mode is window mode it shows desktop style scrollbar in mobile
Switching happens dynamically.
To post a comment you must log in.
Revision history for this message

Chris Coulson (chrisccoulson) wrote : | # |
Thanks, I've left some comments inline.
Also, this appears to still rely on GetFormFactor() to add --enable-
And I'd prefer not to expose ShellMode to the renderer side - I'd rather we just exposed the desired scrollbar configuration
review:
Needs Fixing
Revision history for this message

Santosh (santoshbit2007) : | # |
Unmerged commits
- 37f64b2... by Santosh
-
Implement scrollbar switch when shell mode is changed.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | diff --git a/shared/BUILD.gn b/shared/BUILD.gn | |||
2 | index c847f04..3976892 100644 | |||
3 | --- a/shared/BUILD.gn | |||
4 | +++ b/shared/BUILD.gn | |||
5 | @@ -456,6 +456,8 @@ component("shared") { | |||
6 | 456 | "browser/screen.h", | 456 | "browser/screen.h", |
7 | 457 | "browser/screen_observer.cc", | 457 | "browser/screen_observer.cc", |
8 | 458 | "browser/screen_observer.h", | 458 | "browser/screen_observer.h", |
9 | 459 | "browser/scrollbar_type.cc", | ||
10 | 460 | "browser/scrollbar_type.h", | ||
11 | 459 | "browser/shell_mode.h", | 461 | "browser/shell_mode.h", |
12 | 460 | "browser/ssl/oxide_certificate_error.cc", | 462 | "browser/ssl/oxide_certificate_error.cc", |
13 | 461 | "browser/ssl/oxide_certificate_error.h", | 463 | "browser/ssl/oxide_certificate_error.h", |
14 | @@ -556,6 +558,8 @@ component("shared") { | |||
15 | 556 | "renderer/oxide_v8_scoped_persistent.h", | 558 | "renderer/oxide_v8_scoped_persistent.h", |
16 | 557 | "renderer/oxide_web_content_settings_client.cc", | 559 | "renderer/oxide_web_content_settings_client.cc", |
17 | 558 | "renderer/oxide_web_content_settings_client.h", | 560 | "renderer/oxide_web_content_settings_client.h", |
18 | 561 | "renderer/oxide_scrollbar_state.cc", | ||
19 | 562 | "renderer/oxide_scrollbar_state.h" | ||
20 | 559 | ] | 563 | ] |
21 | 560 | 564 | ||
22 | 561 | if (is_linux) { | 565 | if (is_linux) { |
23 | diff --git a/shared/browser/oxide_content_browser_client.cc b/shared/browser/oxide_content_browser_client.cc | |||
24 | index 876b1ad..7cd6777 100644 | |||
25 | --- a/shared/browser/oxide_content_browser_client.cc | |||
26 | +++ b/shared/browser/oxide_content_browser_client.cc | |||
27 | @@ -45,6 +45,7 @@ | |||
28 | 45 | #include "shared/browser/ssl/oxide_certificate_error_dispatcher.h" | 45 | #include "shared/browser/ssl/oxide_certificate_error_dispatcher.h" |
29 | 46 | #include "shared/common/oxide_constants.h" | 46 | #include "shared/common/oxide_constants.h" |
30 | 47 | #include "shared/common/oxide_content_client.h" | 47 | #include "shared/common/oxide_content_client.h" |
31 | 48 | #include "shared/common/oxide_messages.h" | ||
32 | 48 | 49 | ||
33 | 49 | #include "display_form_factor.h" | 50 | #include "display_form_factor.h" |
34 | 50 | #include "in_process_renderer_observer.h" | 51 | #include "in_process_renderer_observer.h" |
35 | @@ -60,6 +61,7 @@ | |||
36 | 60 | #include "oxide_user_agent_settings.h" | 61 | #include "oxide_user_agent_settings.h" |
37 | 61 | #include "oxide_web_contents_view.h" | 62 | #include "oxide_web_contents_view.h" |
38 | 62 | #include "screen.h" | 63 | #include "screen.h" |
39 | 64 | #include "scrollbar_type.h" | ||
40 | 63 | #include "shell_mode.h" | 65 | #include "shell_mode.h" |
41 | 64 | #include "web_contents_client.h" | 66 | #include "web_contents_client.h" |
42 | 65 | #include "web_contents_helper.h" | 67 | #include "web_contents_helper.h" |
43 | @@ -100,6 +102,7 @@ void ContentBrowserClient::RenderProcessWillLaunch( | |||
44 | 100 | } | 102 | } |
45 | 101 | 103 | ||
46 | 102 | host->AddFilter(new RenderMessageFilter(host)); | 104 | host->AddFilter(new RenderMessageFilter(host)); |
47 | 105 | host->Send(new OxideMsg_ChangeScrollbarType(IsScrollbarTypeOverlay())); | ||
48 | 103 | } | 106 | } |
49 | 104 | 107 | ||
50 | 105 | void ContentBrowserClient::SiteInstanceGotProcess( | 108 | void ContentBrowserClient::SiteInstanceGotProcess( |
51 | @@ -304,11 +307,14 @@ void ContentBrowserClient::OverrideWebkitPrefs( | |||
52 | 304 | prefs->shrinks_viewport_contents_to_fit = true; | 307 | prefs->shrinks_viewport_contents_to_fit = true; |
53 | 305 | prefs->viewport_enabled = true; | 308 | prefs->viewport_enabled = true; |
54 | 306 | prefs->main_frame_resizes_are_orientation_changes = true; | 309 | prefs->main_frame_resizes_are_orientation_changes = true; |
55 | 310 | prefs->use_solid_color_scrollbars = true; | ||
56 | 307 | } else { | 311 | } else { |
57 | 308 | prefs->shrinks_viewport_contents_to_fit = false; | 312 | prefs->shrinks_viewport_contents_to_fit = false; |
58 | 309 | prefs->default_minimum_page_scale_factor = 1.0f; | 313 | prefs->default_minimum_page_scale_factor = 1.0f; |
59 | 310 | prefs->viewport_enabled = false; | 314 | prefs->viewport_enabled = false; |
60 | 311 | prefs->main_frame_resizes_are_orientation_changes = false; | 315 | prefs->main_frame_resizes_are_orientation_changes = false; |
61 | 316 | // Aura(desktop) overlay scrollbar never use solid color scrollbars | ||
62 | 317 | prefs->use_solid_color_scrollbars = false; | ||
63 | 312 | } | 318 | } |
64 | 313 | 319 | ||
65 | 314 | prefs->supports_multiple_windows = false; | 320 | prefs->supports_multiple_windows = false; |
66 | @@ -317,7 +323,6 @@ void ContentBrowserClient::OverrideWebkitPrefs( | |||
67 | 317 | contents_helper->client()->CanCreateWindows(); | 323 | contents_helper->client()->CanCreateWindows(); |
68 | 318 | } | 324 | } |
69 | 319 | 325 | ||
70 | 320 | prefs->use_solid_color_scrollbars = ui::IsOverlayScrollbarEnabled(); | ||
71 | 321 | } | 326 | } |
72 | 322 | 327 | ||
73 | 323 | content::DevToolsManagerDelegate* | 328 | content::DevToolsManagerDelegate* |
74 | diff --git a/shared/browser/scrollbar_type.cc b/shared/browser/scrollbar_type.cc | |||
75 | 324 | new file mode 100644 | 329 | new file mode 100644 |
76 | index 0000000..4f7feba | |||
77 | --- /dev/null | |||
78 | +++ b/shared/browser/scrollbar_type.cc | |||
79 | @@ -0,0 +1,37 @@ | |||
80 | 1 | // vim:expandtab:shiftwidth=2:tabstop=2: | ||
81 | 2 | // Copyright (C) 2016 Canonical Ltd. | ||
82 | 3 | |||
83 | 4 | // This library is free software; you can redistribute it and/or | ||
84 | 5 | // modify it under the terms of the GNU Lesser General Public | ||
85 | 6 | // License as published by the Free Software Foundation; either | ||
86 | 7 | // version 2.1 of the License, or (at your option) any later version. | ||
87 | 8 | |||
88 | 9 | // This library is distributed in the hope that it will be useful, | ||
89 | 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
90 | 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
91 | 12 | // Lesser General Public License for more details. | ||
92 | 13 | |||
93 | 14 | // You should have received a copy of the GNU Lesser General Public | ||
94 | 15 | // License along with this library; if not, write to the Free Software | ||
95 | 16 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
96 | 17 | |||
97 | 18 | #include "shared/browser/scrollbar_type.h" | ||
98 | 19 | |||
99 | 20 | #include "ui/native_theme/native_theme_switches.h" | ||
100 | 21 | |||
101 | 22 | #include "screen.h" | ||
102 | 23 | #include "shell_mode.h" | ||
103 | 24 | |||
104 | 25 | namespace oxide { | ||
105 | 26 | |||
106 | 27 | bool IsScrollbarTypeOverlay() { | ||
107 | 28 | bool is_overlay = ui::IsOverlayScrollbarEnabled(); | ||
108 | 29 | ShellMode mode = Screen::GetInstance()->GetShellMode(); | ||
109 | 30 | if (mode == ShellMode::Windowed) { | ||
110 | 31 | is_overlay = false; | ||
111 | 32 | } | ||
112 | 33 | |||
113 | 34 | return is_overlay; | ||
114 | 35 | } | ||
115 | 36 | |||
116 | 37 | } // namespace oxide | ||
117 | diff --git a/shared/browser/scrollbar_type.h b/shared/browser/scrollbar_type.h | |||
118 | 0 | new file mode 100644 | 38 | new file mode 100644 |
119 | index 0000000..171a5ab | |||
120 | --- /dev/null | |||
121 | +++ b/shared/browser/scrollbar_type.h | |||
122 | @@ -0,0 +1,27 @@ | |||
123 | 1 | // vim:expandtab:shiftwidth=2:tabstop=2: | ||
124 | 2 | // Copyright (C) 2016 Canonical Ltd. | ||
125 | 3 | |||
126 | 4 | // This library is free software; you can redistribute it and/or | ||
127 | 5 | // modify it under the terms of the GNU Lesser General Public | ||
128 | 6 | // License as published by the Free Software Foundation; either | ||
129 | 7 | // version 2.1 of the License, or (at your option) any later version. | ||
130 | 8 | |||
131 | 9 | // This library is distributed in the hope that it will be useful, | ||
132 | 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
133 | 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
134 | 12 | // Lesser General Public License for more details. | ||
135 | 13 | |||
136 | 14 | // You should have received a copy of the GNU Lesser General Public | ||
137 | 15 | // License along with this library; if not, write to the Free Software | ||
138 | 16 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
139 | 17 | |||
140 | 18 | #ifndef _OXIDE_SHARED_BROWSER_SCROLLBAR_TYPE_H_ | ||
141 | 19 | #define _OXIDE_SHARED_BROWSER_SCROLLBAR_TYPE_H_ | ||
142 | 20 | |||
143 | 21 | namespace oxide { | ||
144 | 22 | |||
145 | 23 | bool IsScrollbarTypeOverlay(); | ||
146 | 24 | |||
147 | 25 | } // namespace oxide | ||
148 | 26 | |||
149 | 27 | #endif | ||
150 | diff --git a/shared/browser/web_contents_helper.cc b/shared/browser/web_contents_helper.cc | |||
151 | index ebcead1..8c0130a 100644 | |||
152 | --- a/shared/browser/web_contents_helper.cc | |||
153 | +++ b/shared/browser/web_contents_helper.cc | |||
154 | @@ -21,18 +21,21 @@ | |||
155 | 21 | 21 | ||
156 | 22 | #include "base/lazy_instance.h" | 22 | #include "base/lazy_instance.h" |
157 | 23 | #include "base/logging.h" | 23 | #include "base/logging.h" |
158 | 24 | #include "content/public/browser/render_process_host.h" | ||
159 | 24 | #include "content/public/browser/render_view_host.h" | 25 | #include "content/public/browser/render_view_host.h" |
160 | 25 | #include "content/public/browser/web_contents.h" | 26 | #include "content/public/browser/web_contents.h" |
161 | 26 | #include "content/public/common/renderer_preferences.h" | 27 | #include "content/public/common/renderer_preferences.h" |
162 | 27 | #include "ui/display/display.h" | 28 | #include "ui/display/display.h" |
163 | 28 | 29 | ||
164 | 29 | #include "shared/common/oxide_content_client.h" | 30 | #include "shared/common/oxide_content_client.h" |
165 | 31 | #include "shared/common/oxide_messages.h" | ||
166 | 30 | 32 | ||
167 | 31 | #include "oxide_browser_context.h" | 33 | #include "oxide_browser_context.h" |
168 | 32 | #include "oxide_user_agent_settings.h" | 34 | #include "oxide_user_agent_settings.h" |
169 | 33 | #include "oxide_web_contents_unloader.h" | 35 | #include "oxide_web_contents_unloader.h" |
170 | 34 | #include "oxide_web_contents_view.h" | 36 | #include "oxide_web_contents_view.h" |
171 | 35 | #include "oxide_web_view.h" | 37 | #include "oxide_web_view.h" |
172 | 38 | #include "scrollbar_type.h" | ||
173 | 36 | #include "web_preferences.h" | 39 | #include "web_preferences.h" |
174 | 37 | 40 | ||
175 | 38 | namespace oxide { | 41 | namespace oxide { |
176 | @@ -126,6 +129,12 @@ void WebContentsHelper::OnDisplayPropertiesChanged( | |||
177 | 126 | 129 | ||
178 | 127 | void WebContentsHelper::OnShellModeChanged() { | 130 | void WebContentsHelper::OnShellModeChanged() { |
179 | 128 | SyncWebPreferences(); | 131 | SyncWebPreferences(); |
180 | 132 | for (content::RenderProcessHost::iterator rph_iter( | ||
181 | 133 | content::RenderProcessHost::AllHostsIterator()); | ||
182 | 134 | !rph_iter.IsAtEnd(); rph_iter.Advance()) { | ||
183 | 135 | rph_iter.GetCurrentValue()->Send( | ||
184 | 136 | new OxideMsg_ChangeScrollbarType(IsScrollbarTypeOverlay())); | ||
185 | 137 | } | ||
186 | 129 | } | 138 | } |
187 | 130 | 139 | ||
188 | 131 | // static | 140 | // static |
189 | diff --git a/shared/common/oxide_messages.h b/shared/common/oxide_messages.h | |||
190 | index 0375b9b..d4cb12d 100644 | |||
191 | --- a/shared/common/oxide_messages.h | |||
192 | +++ b/shared/common/oxide_messages.h | |||
193 | @@ -43,6 +43,8 @@ IPC_MESSAGE_CONTROL1(OxideMsg_UpdateUserScripts, | |||
194 | 43 | IPC_MESSAGE_CONTROL1(OxideMsg_SetUserAgent, | 43 | IPC_MESSAGE_CONTROL1(OxideMsg_SetUserAgent, |
195 | 44 | std::string) | 44 | std::string) |
196 | 45 | 45 | ||
197 | 46 | IPC_MESSAGE_CONTROL1(OxideMsg_ChangeScrollbarType, bool) | ||
198 | 47 | |||
199 | 46 | IPC_MESSAGE_ROUTED1(OxideMsg_SendMessage, | 48 | IPC_MESSAGE_ROUTED1(OxideMsg_SendMessage, |
200 | 47 | oxide::ScriptMessageParams) | 49 | oxide::ScriptMessageParams) |
201 | 48 | 50 | ||
202 | diff --git a/shared/renderer/oxide_content_renderer_client.cc b/shared/renderer/oxide_content_renderer_client.cc | |||
203 | index 934c19b..063f51b 100644 | |||
204 | --- a/shared/renderer/oxide_content_renderer_client.cc | |||
205 | +++ b/shared/renderer/oxide_content_renderer_client.cc | |||
206 | @@ -40,6 +40,7 @@ | |||
207 | 40 | #include "browser_controls_handler.h" | 40 | #include "browser_controls_handler.h" |
208 | 41 | #include "oxide_renderer_user_agent_settings.h" | 41 | #include "oxide_renderer_user_agent_settings.h" |
209 | 42 | #include "oxide_script_message_dispatcher_renderer.h" | 42 | #include "oxide_script_message_dispatcher_renderer.h" |
210 | 43 | #include "oxide_scrollbar_state.h" | ||
211 | 43 | #include "oxide_user_script_scheduler.h" | 44 | #include "oxide_user_script_scheduler.h" |
212 | 44 | #include "oxide_user_script_slave.h" | 45 | #include "oxide_user_script_slave.h" |
213 | 45 | #include "oxide_web_content_settings_client.h" | 46 | #include "oxide_web_content_settings_client.h" |
214 | @@ -60,7 +61,10 @@ void ContentRendererClient::RenderThreadStarted() { | |||
215 | 60 | 61 | ||
216 | 61 | user_agent_settings_.reset(new RendererUserAgentSettings()); | 62 | user_agent_settings_.reset(new RendererUserAgentSettings()); |
217 | 62 | thread->AddObserver(user_agent_settings_.get()); | 63 | thread->AddObserver(user_agent_settings_.get()); |
219 | 63 | 64 | ||
220 | 65 | scrollbar_state_.reset(new ScrollbarState()); | ||
221 | 66 | thread->AddObserver(scrollbar_state_.get()); | ||
222 | 67 | |||
223 | 64 | new UserScriptSlave(); | 68 | new UserScriptSlave(); |
224 | 65 | 69 | ||
225 | 66 | net::NetModule::SetResourceProvider(NetResourceProvider); | 70 | net::NetModule::SetResourceProvider(NetResourceProvider); |
226 | @@ -149,7 +153,8 @@ void ContentRendererClient::OverrideCompositorSettings( | |||
227 | 149 | // be able to have 2 different overlay scrollbar styles (a small | 153 | // be able to have 2 different overlay scrollbar styles (a small |
228 | 150 | // non-hit-tested style for mobile and a much larger hit-tested style | 154 | // non-hit-tested style for mobile and a much larger hit-tested style |
229 | 151 | // for desktop) | 155 | // for desktop) |
231 | 152 | if (ui::IsOverlayScrollbarEnabled()) { | 156 | if (ui::IsOverlayScrollbarEnabled() && |
232 | 157 | (scrollbar_state_->IsScrollbarTypeOverlay())) { | ||
233 | 153 | // XXX: This will need updating if we support overlay scrollbars on | 158 | // XXX: This will need updating if we support overlay scrollbars on |
234 | 154 | // desktop. See https://launchpad.net/bugs/1426567 | 159 | // desktop. See https://launchpad.net/bugs/1426567 |
235 | 155 | settings->scrollbar_animator = cc::LayerTreeSettings::LINEAR_FADE; | 160 | settings->scrollbar_animator = cc::LayerTreeSettings::LINEAR_FADE; |
236 | diff --git a/shared/renderer/oxide_content_renderer_client.h b/shared/renderer/oxide_content_renderer_client.h | |||
237 | index 9dbb950..5f971d9 100644 | |||
238 | --- a/shared/renderer/oxide_content_renderer_client.h | |||
239 | +++ b/shared/renderer/oxide_content_renderer_client.h | |||
240 | @@ -30,6 +30,7 @@ class RendererMediaPlayerManager; | |||
241 | 30 | #endif | 30 | #endif |
242 | 31 | 31 | ||
243 | 32 | class RendererUserAgentSettings; | 32 | class RendererUserAgentSettings; |
244 | 33 | class ScrollbarState; | ||
245 | 33 | 34 | ||
246 | 34 | class ContentRendererClient : public content::ContentRendererClient { | 35 | class ContentRendererClient : public content::ContentRendererClient { |
247 | 35 | public: | 36 | public: |
248 | @@ -59,6 +60,7 @@ class ContentRendererClient : public content::ContentRendererClient { | |||
249 | 59 | std::string GetUserAgentOverrideForURL(const GURL& url) override; | 60 | std::string GetUserAgentOverrideForURL(const GURL& url) override; |
250 | 60 | 61 | ||
251 | 61 | std::unique_ptr<RendererUserAgentSettings> user_agent_settings_; | 62 | std::unique_ptr<RendererUserAgentSettings> user_agent_settings_; |
252 | 63 | std::unique_ptr<ScrollbarState> scrollbar_state_; | ||
253 | 62 | 64 | ||
254 | 63 | DISALLOW_COPY_AND_ASSIGN(ContentRendererClient); | 65 | DISALLOW_COPY_AND_ASSIGN(ContentRendererClient); |
255 | 64 | }; | 66 | }; |
256 | diff --git a/shared/renderer/oxide_scrollbar_state.cc b/shared/renderer/oxide_scrollbar_state.cc | |||
257 | 65 | new file mode 100644 | 67 | new file mode 100644 |
258 | index 0000000..e414f1e | |||
259 | --- /dev/null | |||
260 | +++ b/shared/renderer/oxide_scrollbar_state.cc | |||
261 | @@ -0,0 +1,54 @@ | |||
262 | 1 | // vim:expandtab:shiftwidth=2:tabstop=2: | ||
263 | 2 | // Copyright (C) 2015 Canonical Ltd. | ||
264 | 3 | |||
265 | 4 | // This library is free software; you can redistribute it and/or | ||
266 | 5 | // modify it under the terms of the GNU Lesser General Public | ||
267 | 6 | // License as published by the Free Software Foundation; either | ||
268 | 7 | // version 2.1 of the License, or (at your option) any later version. | ||
269 | 8 | |||
270 | 9 | // This library is distributed in the hope that it will be useful, | ||
271 | 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
272 | 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
273 | 12 | // Lesser General Public License for more details. | ||
274 | 13 | |||
275 | 14 | // You should have received a copy of the GNU Lesser General Public | ||
276 | 15 | // License along with this library; if not, write to the Free Software | ||
277 | 16 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
278 | 17 | |||
279 | 18 | #include "shared/renderer/oxide_scrollbar_state.h" | ||
280 | 19 | |||
281 | 20 | #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" | ||
282 | 21 | #include "third_party/WebKit/public/web/WebView.h" | ||
283 | 22 | |||
284 | 23 | #include "base/command_line.h" | ||
285 | 24 | #include "content/public/renderer/render_frame.h" | ||
286 | 25 | #include "ipc/ipc_message_macros.h" | ||
287 | 26 | #include "ui/native_theme/native_theme_switches.h" | ||
288 | 27 | |||
289 | 28 | #include "shared/common/oxide_constants.h" | ||
290 | 29 | #include "shared/common/oxide_messages.h" | ||
291 | 30 | |||
292 | 31 | namespace oxide { | ||
293 | 32 | |||
294 | 33 | ScrollbarState::ScrollbarState() { | ||
295 | 34 | scrollbar_type_overlay_ = ui::IsOverlayScrollbarEnabled(); | ||
296 | 35 | } | ||
297 | 36 | |||
298 | 37 | ScrollbarState::~ScrollbarState() {} | ||
299 | 38 | |||
300 | 39 | bool ScrollbarState::OnControlMessageReceived(const IPC::Message& message) { | ||
301 | 40 | bool handled = true; | ||
302 | 41 | IPC_BEGIN_MESSAGE_MAP(ScrollbarState, message) | ||
303 | 42 | IPC_MESSAGE_HANDLER(OxideMsg_ChangeScrollbarType, OnChangeScrollbarType) | ||
304 | 43 | IPC_MESSAGE_UNHANDLED(handled = false) | ||
305 | 44 | IPC_END_MESSAGE_MAP() | ||
306 | 45 | |||
307 | 46 | return handled; | ||
308 | 47 | } | ||
309 | 48 | |||
310 | 49 | void ScrollbarState::OnChangeScrollbarType(bool is_overlay) { | ||
311 | 50 | scrollbar_type_overlay_ = is_overlay; | ||
312 | 51 | blink::WebRuntimeFeatures::enableOverlayScrollbars(is_overlay); | ||
313 | 52 | } | ||
314 | 53 | |||
315 | 54 | } // namespace oxide | ||
316 | diff --git a/shared/renderer/oxide_scrollbar_state.h b/shared/renderer/oxide_scrollbar_state.h | |||
317 | 0 | new file mode 100644 | 55 | new file mode 100644 |
318 | index 0000000..f643d3f | |||
319 | --- /dev/null | |||
320 | +++ b/shared/renderer/oxide_scrollbar_state.h | |||
321 | @@ -0,0 +1,47 @@ | |||
322 | 1 | // vim:expandtab:shiftwidth=2:tabstop=2: | ||
323 | 2 | // Copyright (C) 2015 Canonical Ltd. | ||
324 | 3 | |||
325 | 4 | // This library is free software; you can redistribute it and/or | ||
326 | 5 | // modify it under the terms of the GNU Lesser General Public | ||
327 | 6 | // License as published by the Free Software Foundation; either | ||
328 | 7 | // version 2.1 of the License, or (at your option) any later version. | ||
329 | 8 | |||
330 | 9 | // This library is distributed in the hope that it will be useful, | ||
331 | 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
332 | 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
333 | 12 | // Lesser General Public License for more details. | ||
334 | 13 | |||
335 | 14 | // You should have received a copy of the GNU Lesser General Public | ||
336 | 15 | // License along with this library; if not, write to the Free Software | ||
337 | 16 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
338 | 17 | |||
339 | 18 | #ifndef _OXIDE_SHARED_RENDERER_SHELL_MODE_STATE_H_ | ||
340 | 19 | #define _OXIDE_SHARED_RENDERER_SHELL_MODE_STATE_H_ | ||
341 | 20 | |||
342 | 21 | #include "content/public/renderer/render_thread_observer.h" | ||
343 | 22 | |||
344 | 23 | #include "shared/browser/shell_mode.h" | ||
345 | 24 | |||
346 | 25 | namespace oxide { | ||
347 | 26 | |||
348 | 27 | class ScrollbarState : public content::RenderThreadObserver { | ||
349 | 28 | public: | ||
350 | 29 | ScrollbarState(); | ||
351 | 30 | ~ScrollbarState() override; | ||
352 | 31 | |||
353 | 32 | bool IsScrollbarTypeOverlay() const { return scrollbar_type_overlay_; } | ||
354 | 33 | |||
355 | 34 | private: | ||
356 | 35 | // RenderThreadObserver implementation | ||
357 | 36 | bool OnControlMessageReceived(const IPC::Message& message) override; | ||
358 | 37 | |||
359 | 38 | void OnChangeScrollbarType(bool is_overlay); | ||
360 | 39 | |||
361 | 40 | bool scrollbar_type_overlay_; | ||
362 | 41 | |||
363 | 42 | DISALLOW_COPY_AND_ASSIGN(ScrollbarState); | ||
364 | 43 | }; | ||
365 | 44 | |||
366 | 45 | } // namespace oxide | ||
367 | 46 | |||
368 | 47 | #endif // _OXIDE_SHARED_RENDERER_SHELL_MODE_STATE_H_ |
overlay scrollbar is controlled by cmd flags --enable- overlay- scrollbar( disable) . Disabling overlay scrollbar using cmd require renderer process restart. so I am not changing command line parameter at runtime instead using the blink Runtime setting to disable overlay scrollbar which is enough to disable the overlayscrollbar from blink.
But outside blink chromium checks for cmd params to find type of scrollbar.
So internal of blink may know overlay scrollbar is disabled but at the same time outside of blink
may see its enabled.
But as of now its all fine, as outside blink there is only one place of checking of "type of scrollbar" which is overridden in oxide_content_ render_ client: :OverrideCompos itorSettings.
So now ui::IsOverlaySc rollbarEnabled( ); will return wrong value when convergence is in picture.