Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(171)

Side by Side Diff: chrome/browser/ui/webui/chrome_web_ui.cc

Issue 8695007: Replace TOUCH_UI condition in WebUI with dynamic flag. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove languages tweak and fix keyboard Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/webui/chrome_web_ui.h" 5 #include "chrome/browser/ui/webui/chrome_web_ui.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/common/chrome_switches.h" 9 #include "chrome/common/chrome_switches.h"
10 #include "content/browser/renderer_host/render_view_host.h"
10 #include "content/browser/tab_contents/tab_contents.h" 11 #include "content/browser/tab_contents/tab_contents.h"
11 12
12 #if defined(TOOLKIT_VIEWS) 13 #if defined(TOOLKIT_VIEWS)
13 #include "ui/views/widget/widget.h" 14 #include "ui/views/widget/widget.h"
14 #endif 15 #endif
15 16
16 namespace { 17 namespace {
17 18
18 // If true, overrides IsMoreWebUI flag. 19 // If true, overrides IsMoreWebUI flag.
19 bool override_more_webui_ = false; 20 bool override_more_webui_ = false;
20 21
21 } // namespace 22 } // namespace
22 23
23 ChromeWebUI::ChromeWebUI(TabContents* contents) 24 ChromeWebUI::ChromeWebUI(TabContents* contents)
24 : WebUI(contents) { 25 : WebUI(contents) {
25 } 26 }
26 27
27 ChromeWebUI::~ChromeWebUI() { 28 ChromeWebUI::~ChromeWebUI() {
28 } 29 }
29 30
30 Profile* ChromeWebUI::GetProfile() const { 31 Profile* ChromeWebUI::GetProfile() const {
31 return Profile::FromBrowserContext(tab_contents()->browser_context()); 32 return Profile::FromBrowserContext(tab_contents()->browser_context());
32 } 33 }
33 34
34 bool ChromeWebUI::CanShowBookmarkBar() const { 35 bool ChromeWebUI::CanShowBookmarkBar() const {
35 return false; 36 return false;
36 } 37 }
37 38
39 void ChromeWebUI::RenderViewCreated(RenderViewHost* render_view_host) {
40 WebUI::RenderViewCreated(render_view_host);
41
42 // Let the WebUI know that we're looking for UI that's optimized for touch
43 // input.
44 // TODO(rbyers) Figure out the right model for enabling touch-optimized UI
45 // (http://crbug.com/105380).
46 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kTouchOptimizedUI))
47 render_view_host->SetWebUIProperty("touchOptimized","true");
flackr 2011/11/30 16:00:46 Add a space before "true".
Rick Byers 2011/11/30 16:23:07 Done.
48 }
49
38 // static 50 // static
39 bool ChromeWebUI::IsMoreWebUI() { 51 bool ChromeWebUI::IsMoreWebUI() {
40 bool more_webui = CommandLine::ForCurrentProcess()->HasSwitch( 52 bool more_webui = CommandLine::ForCurrentProcess()->HasSwitch(
41 switches::kUseMoreWebUI) || override_more_webui_; 53 switches::kUseMoreWebUI) || override_more_webui_;
42 #if defined(TOOLKIT_VIEWS) 54 #if defined(TOOLKIT_VIEWS)
43 more_webui |= views::Widget::IsPureViews(); 55 more_webui |= views::Widget::IsPureViews();
44 #endif 56 #endif
45 return more_webui; 57 return more_webui;
46 } 58 }
47 59
48 void ChromeWebUI::OverrideMoreWebUI(bool use_more_webui) { 60 void ChromeWebUI::OverrideMoreWebUI(bool use_more_webui) {
49 override_more_webui_ = use_more_webui; 61 override_more_webui_ = use_more_webui;
50 } 62 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698