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

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

Issue 3771003: First round UI touch up of DOMUI based network menu. (Closed) Base URL: http://git.chromium.org/git/chromium.git
Patch Set: sync and try Created 10 years, 2 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
« no previous file with comments | « chrome/browser/chromeos/dom_ui/network_menu_ui.h ('k') | chrome/browser/resources/menu.css » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/network_menu_ui.h" 5 #include "chrome/browser/chromeos/dom_ui/network_menu_ui.h"
6 6
7 #include "app/l10n_util.h"
7 #include "base/values.h" 8 #include "base/values.h"
8 #include "base/string_number_conversions.h" 9 #include "base/string_number_conversions.h"
9 #include "base/string_util.h" 10 #include "base/string_util.h"
10 #include "chrome/app/chrome_dll_resource.h" 11 #include "chrome/app/chrome_dll_resource.h"
11 #include "chrome/browser/chromeos/status/network_menu.h" 12 #include "chrome/browser/chromeos/status/network_menu.h"
12 #include "chrome/browser/chromeos/views/native_menu_domui.h" 13 #include "chrome/browser/chromeos/views/native_menu_domui.h"
13 #include "chrome/common/url_constants.h" 14 #include "chrome/common/url_constants.h"
14 #include "googleurl/src/gurl.h" 15 #include "googleurl/src/gurl.h"
15 #include "grit/browser_resources.h" 16 #include "grit/browser_resources.h"
17 #include "grit/generated_resources.h"
16 #include "views/controls/menu/menu_2.h" 18 #include "views/controls/menu/menu_2.h"
17 19
18 namespace { 20 namespace {
19 21
20 //////////////////////////////////////////////////////////////////////////////// 22 ////////////////////////////////////////////////////////////////////////////////
21 // 23 //
22 // MenuHandler 24 // MenuHandler
23 // 25 //
24 //////////////////////////////////////////////////////////////////////////////// 26 ////////////////////////////////////////////////////////////////////////////////
25 27
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 //////////////////////////////////////////////////////////////////////////////// 71 ////////////////////////////////////////////////////////////////////////////////
70 72
71 NetworkMenuUI::NetworkMenuUI(TabContents* contents) 73 NetworkMenuUI::NetworkMenuUI(TabContents* contents)
72 : chromeos::MenuUI( 74 : chromeos::MenuUI(
73 contents, 75 contents,
74 ALLOW_THIS_IN_INITIALIZER_LIST( 76 ALLOW_THIS_IN_INITIALIZER_LIST(
75 CreateMenuUIHTMLSource(*this, 77 CreateMenuUIHTMLSource(*this,
76 chrome::kChromeUINetworkMenu, 78 chrome::kChromeUINetworkMenu,
77 "NetworkMenu", 79 "NetworkMenu",
78 IDR_NETWORK_MENU_JS, 80 IDR_NETWORK_MENU_JS,
79 -1))) { 81 IDR_NETWORK_MENU_CSS))) {
80 NetworkMenuHandler* handler = new NetworkMenuHandler(); 82 NetworkMenuHandler* handler = new NetworkMenuHandler();
81 AddMessageHandler((handler)->Attach(this)); 83 AddMessageHandler((handler)->Attach(this));
82 } 84 }
83 85
84 void NetworkMenuUI::AddCustomConfigValues(DictionaryValue* config) const { 86 void NetworkMenuUI::AddCustomConfigValues(DictionaryValue* config) const {
85 } 87 }
86 88
89 void NetworkMenuUI::AddLocalizedStrings(
90 DictionaryValue* localized_strings) const {
91 DCHECK(localized_strings);
92
93 localized_strings->SetString("reconnect", l10n_util::GetStringUTF16(
94 IDS_NETWORK_RECONNECT_TITLE));
95 localized_strings->SetString("remeber_this_network",
96 l10n_util::GetStringUTF16(IDS_NETWORK_REMEMBER_THIS_NETWORK_TITLE));
97 localized_strings->SetString("ssid_prompt",
98 l10n_util::GetStringUTF16(IDS_NETWORK_SSID_HINT));
99 localized_strings->SetString("pass_prompt",
100 l10n_util::GetStringUTF16(IDS_NETWORK_PASSWORD_HINT));
101 }
102
87 void NetworkMenuUI::ModelAction(const menus::MenuModel* model, 103 void NetworkMenuUI::ModelAction(const menus::MenuModel* model,
88 const ListValue* values) { 104 const ListValue* values) {
89 const NetworkMenu* network_menu = static_cast<const NetworkMenu*>(model); 105 const NetworkMenu* network_menu = static_cast<const NetworkMenu*>(model);
90 std::string action; 106 std::string action;
91 bool success = values->GetString(0, &action); 107 bool success = values->GetString(0, &action);
92 if (!success) { 108 if (!success) {
93 LOG(WARNING) << "ModelAction called with no arguments from: " 109 LOG(WARNING) << "ModelAction called with no arguments from: "
94 << chrome::kChromeUINetworkMenu; 110 << chrome::kChromeUINetworkMenu;
95 return; 111 return;
96 } 112 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 } 158 }
143 159
144 views::Menu2* NetworkMenuUI::CreateMenu2(menus::MenuModel* model) { 160 views::Menu2* NetworkMenuUI::CreateMenu2(menus::MenuModel* model) {
145 views::Menu2* menu = new views::Menu2(model); 161 views::Menu2* menu = new views::Menu2(model);
146 NativeMenuDOMUI::SetMenuURL( 162 NativeMenuDOMUI::SetMenuURL(
147 menu, GURL(StringPrintf("chrome://%s", chrome::kChromeUINetworkMenu))); 163 menu, GURL(StringPrintf("chrome://%s", chrome::kChromeUINetworkMenu)));
148 return menu; 164 return menu;
149 } 165 }
150 166
151 } // namespace chromeos 167 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/dom_ui/network_menu_ui.h ('k') | chrome/browser/resources/menu.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698