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

Side by Side Diff: chrome/browser/chromeos/dom_ui/wrench_menu_ui.cc

Issue 6250123: WebUI: Change DOMUI to WebUI in two chromeos classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: avi review Created 9 years, 10 months 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) 2010 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/chromeos/dom_ui/wrench_menu_ui.h" 5 #include "chrome/browser/chromeos/dom_ui/wrench_menu_ui.h"
6 6
7 #include "base/string_number_conversions.h" 7 #include "base/string_number_conversions.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "base/values.h" 10 #include "base/values.h"
11 #include "base/weak_ptr.h" 11 #include "base/weak_ptr.h"
12 #include "chrome/app/chrome_command_ids.h" 12 #include "chrome/app/chrome_command_ids.h"
13 #include "chrome/browser/browser_list.h" 13 #include "chrome/browser/browser_list.h"
14 #include "chrome/browser/chromeos/views/domui_menu_widget.h"
15 #include "chrome/browser/chromeos/views/native_menu_domui.h" 14 #include "chrome/browser/chromeos/views/native_menu_domui.h"
15 #include "chrome/browser/chromeos/views/webui_menu_widget.h"
16 #include "chrome/browser/tab_contents/tab_contents.h" 16 #include "chrome/browser/tab_contents/tab_contents.h"
17 #include "chrome/browser/ui/browser.h" 17 #include "chrome/browser/ui/browser.h"
18 #include "chrome/common/notification_registrar.h" 18 #include "chrome/common/notification_registrar.h"
19 #include "chrome/common/notification_source.h" 19 #include "chrome/common/notification_source.h"
20 #include "chrome/common/url_constants.h" 20 #include "chrome/common/url_constants.h"
21 #include "googleurl/src/gurl.h" 21 #include "googleurl/src/gurl.h"
22 #include "grit/browser_resources.h" 22 #include "grit/browser_resources.h"
23 #include "grit/generated_resources.h" 23 #include "grit/generated_resources.h"
24 #include "ui/base/l10n/l10n_util.h" 24 #include "ui/base/l10n/l10n_util.h"
25 #include "views/controls/menu/menu_2.h" 25 #include "views/controls/menu/menu_2.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 } 75 }
76 76
77 void WrenchMenuUI::Observe(NotificationType type, 77 void WrenchMenuUI::Observe(NotificationType type,
78 const NotificationSource& source, 78 const NotificationSource& source,
79 const NotificationDetails& details) { 79 const NotificationDetails& details) {
80 DCHECK_EQ(NotificationType::ZOOM_LEVEL_CHANGED, type.value); 80 DCHECK_EQ(NotificationType::ZOOM_LEVEL_CHANGED, type.value);
81 UpdateZoomControls(); 81 UpdateZoomControls();
82 } 82 }
83 83
84 void WrenchMenuUI::UpdateZoomControls() { 84 void WrenchMenuUI::UpdateZoomControls() {
85 DOMUIMenuWidget* widget = DOMUIMenuWidget::FindDOMUIMenuWidget( 85 WebUIMenuWidget* widget = WebUIMenuWidget::FindWebUIMenuWidget(
86 tab_contents()->GetNativeView()); 86 tab_contents()->GetNativeView());
87 if (!widget || !widget->is_root()) 87 if (!widget || !widget->is_root())
88 return; 88 return;
89 Browser* browser = BrowserList::GetLastActive(); 89 Browser* browser = BrowserList::GetLastActive();
90 if (!browser) 90 if (!browser)
91 return; 91 return;
92 TabContents* selected_tab = browser->GetSelectedTabContents(); 92 TabContents* selected_tab = browser->GetSelectedTabContents();
93 bool enable_increment = false; 93 bool enable_increment = false;
94 bool enable_decrement = false; 94 bool enable_decrement = false;
95 int zoom = 100; 95 int zoom = 100;
96 if (selected_tab) 96 if (selected_tab)
97 zoom = selected_tab->GetZoomPercent(&enable_increment, &enable_decrement); 97 zoom = selected_tab->GetZoomPercent(&enable_increment, &enable_decrement);
98 98
99 DictionaryValue params; 99 DictionaryValue params;
100 params.SetBoolean("plus", enable_increment); 100 params.SetBoolean("plus", enable_increment);
101 params.SetBoolean("minus", enable_decrement); 101 params.SetBoolean("minus", enable_decrement);
102 params.SetString("percent", l10n_util::GetStringFUTF16( 102 params.SetString("percent", l10n_util::GetStringFUTF16(
103 IDS_ZOOM_PERCENT, UTF8ToUTF16(base::IntToString(zoom)))); 103 IDS_ZOOM_PERCENT, UTF8ToUTF16(base::IntToString(zoom))));
104 CallJavascriptFunction(L"updateZoomControls", params); 104 CallJavascriptFunction(L"updateZoomControls", params);
105 } 105 }
106 106
107 views::Menu2* WrenchMenuUI::CreateMenu2(ui::MenuModel* model) { 107 views::Menu2* WrenchMenuUI::CreateMenu2(ui::MenuModel* model) {
108 views::Menu2* menu = new views::Menu2(model); 108 views::Menu2* menu = new views::Menu2(model);
109 NativeMenuDOMUI::SetMenuURL( 109 NativeMenuDOMUI::SetMenuURL(
110 menu, GURL(StringPrintf("chrome://%s", chrome::kChromeUIWrenchMenu))); 110 menu, GURL(StringPrintf("chrome://%s", chrome::kChromeUIWrenchMenu)));
111 return menu; 111 return menu;
112 } 112 }
113 113
114 } // namespace chromeos 114 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/dom_ui/network_menu_ui.cc ('k') | chrome/browser/chromeos/views/menu_locator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698