| OLD | NEW |
| 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_util.h" | 9 #include "base/string_util.h" |
| 9 #include "chrome/app/chrome_dll_resource.h" | 10 #include "chrome/app/chrome_dll_resource.h" |
| 10 #include "chrome/browser/chromeos/status/network_menu.h" | 11 #include "chrome/browser/chromeos/status/network_menu.h" |
| 11 #include "chrome/browser/chromeos/views/native_menu_domui.h" | 12 #include "chrome/browser/chromeos/views/native_menu_domui.h" |
| 12 #include "chrome/common/url_constants.h" | 13 #include "chrome/common/url_constants.h" |
| 13 #include "googleurl/src/gurl.h" | 14 #include "googleurl/src/gurl.h" |
| 14 #include "grit/browser_resources.h" | 15 #include "grit/browser_resources.h" |
| 16 #include "grit/generated_resources.h" |
| 15 #include "views/controls/menu/menu_2.h" | 17 #include "views/controls/menu/menu_2.h" |
| 16 | 18 |
| 17 namespace { | 19 namespace { |
| 18 | 20 |
| 19 //////////////////////////////////////////////////////////////////////////////// | 21 //////////////////////////////////////////////////////////////////////////////// |
| 20 // | 22 // |
| 21 // MenuHandler | 23 // MenuHandler |
| 22 // | 24 // |
| 23 //////////////////////////////////////////////////////////////////////////////// | 25 //////////////////////////////////////////////////////////////////////////////// |
| 24 | 26 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 //////////////////////////////////////////////////////////////////////////////// | 70 //////////////////////////////////////////////////////////////////////////////// |
| 69 | 71 |
| 70 NetworkMenuUI::NetworkMenuUI(TabContents* contents) | 72 NetworkMenuUI::NetworkMenuUI(TabContents* contents) |
| 71 : chromeos::MenuUI( | 73 : chromeos::MenuUI( |
| 72 contents, | 74 contents, |
| 73 ALLOW_THIS_IN_INITIALIZER_LIST( | 75 ALLOW_THIS_IN_INITIALIZER_LIST( |
| 74 CreateMenuUIHTMLSource(*this, | 76 CreateMenuUIHTMLSource(*this, |
| 75 chrome::kChromeUINetworkMenu, | 77 chrome::kChromeUINetworkMenu, |
| 76 "NetworkMenu", | 78 "NetworkMenu", |
| 77 IDR_NETWORK_MENU_JS, | 79 IDR_NETWORK_MENU_JS, |
| 78 -1))) { | 80 IDR_NETWORK_MENU_CSS))) { |
| 79 NetworkMenuHandler* handler = new NetworkMenuHandler(); | 81 NetworkMenuHandler* handler = new NetworkMenuHandler(); |
| 80 AddMessageHandler((handler)->Attach(this)); | 82 AddMessageHandler((handler)->Attach(this)); |
| 81 } | 83 } |
| 82 | 84 |
| 83 void NetworkMenuUI::AddCustomConfigValues(DictionaryValue* config) const { | 85 void NetworkMenuUI::AddCustomConfigValues(DictionaryValue* config) const { |
| 84 } | 86 } |
| 85 | 87 |
| 88 void NetworkMenuUI::AddLocalizedStrings( |
| 89 DictionaryValue* localized_strings) const { |
| 90 DCHECK(localized_strings); |
| 91 |
| 92 localized_strings->SetString("reconnect", l10n_util::GetStringUTF16( |
| 93 IDS_NETWORK_RECONNECT_TITLE)); |
| 94 localized_strings->SetString("remeber_this_network", |
| 95 l10n_util::GetStringUTF16(IDS_NETWORK_REMEMBER_THIS_NETWORK_TITLE)); |
| 96 localized_strings->SetString("ssid_prompt", |
| 97 l10n_util::GetStringUTF16(IDS_NETWORK_SSID_HINT)); |
| 98 localized_strings->SetString("pass_prompt", |
| 99 l10n_util::GetStringUTF16(IDS_NETWORK_PASSWORD_HINT)); |
| 100 } |
| 101 |
| 86 void NetworkMenuUI::ModelAction(const menus::MenuModel* model, | 102 void NetworkMenuUI::ModelAction(const menus::MenuModel* model, |
| 87 const ListValue* values) { | 103 const ListValue* values) { |
| 88 //const NetworkMenu* network_menu = static_cast<const NetworkMenu*>(model); | 104 //const NetworkMenu* network_menu = static_cast<const NetworkMenu*>(model); |
| 89 // Invoke model methods here. | 105 // Invoke model methods here. |
| 90 } | 106 } |
| 91 | 107 |
| 92 DictionaryValue* NetworkMenuUI::CreateMenuItem(const menus::MenuModel* model, | 108 DictionaryValue* NetworkMenuUI::CreateMenuItem(const menus::MenuModel* model, |
| 93 int index, | 109 int index, |
| 94 const char* type, | 110 const char* type, |
| 95 int* max_icon_width, | 111 int* max_icon_width, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 116 } | 132 } |
| 117 | 133 |
| 118 views::Menu2* NetworkMenuUI::CreateMenu2(menus::MenuModel* model) { | 134 views::Menu2* NetworkMenuUI::CreateMenu2(menus::MenuModel* model) { |
| 119 views::Menu2* menu = new views::Menu2(model); | 135 views::Menu2* menu = new views::Menu2(model); |
| 120 NativeMenuDOMUI::SetMenuURL( | 136 NativeMenuDOMUI::SetMenuURL( |
| 121 menu, GURL(StringPrintf("chrome://%s", chrome::kChromeUINetworkMenu))); | 137 menu, GURL(StringPrintf("chrome://%s", chrome::kChromeUINetworkMenu))); |
| 122 return menu; | 138 return menu; |
| 123 } | 139 } |
| 124 | 140 |
| 125 } // namespace chromeos | 141 } // namespace chromeos |
| OLD | NEW |