diff options
author | sadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-13 04:03:42 +0000 |
---|---|---|
committer | sadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-13 04:03:42 +0000 |
commit | ece882c869353b6a0982892f8f1f40d975930d99 (patch) | |
tree | 27079ceb2982a6dd3801e97fe75650ac9fcdb1d5 /chrome | |
parent | 3c152ed9bd5ea5ad6bf03a7caee2b517a15594a7 (diff) | |
download | chromium_src-ece882c869353b6a0982892f8f1f40d975930d99.zip chromium_src-ece882c869353b6a0982892f8f1f40d975930d99.tar.gz chromium_src-ece882c869353b6a0982892f8f1f40d975930d99.tar.bz2 |
chromeos: Move some network related UI in ui/chromeos/
Move the code responsible for showing network icons into a common component
so that it can be used from both ash and athena. This also moves the relevant
string and image-resources out of ash into separate ui_chromeos_ targets.
R=mmoss@chromium.org, oshima@chromium.org, sky@chromium.org, stevenjb@chromium.org
TBR=derat@ for third_party/cros_system_api owners
BUG=387199
Previously landed in r282837, and reverted in r282839 because it broke non-chromeos builds.
Review URL: https://codereview.chromium.org/351353004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@282858 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/chromeos/status/network_menu.cc | 25 | ||||
-rw-r--r-- | chrome/browser/ui/webui/chromeos/login/network_dropdown.cc | 15 | ||||
-rw-r--r-- | chrome/browser/ui/webui/chromeos/login/network_dropdown.h | 4 | ||||
-rw-r--r-- | chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc | 7 | ||||
-rw-r--r-- | chrome/chrome_browser_ui.gypi | 2 | ||||
-rw-r--r-- | chrome/chrome_repack_chrome_100_percent.gypi | 5 | ||||
-rw-r--r-- | chrome/chrome_repack_chrome_200_percent.gypi | 5 | ||||
-rw-r--r-- | chrome/chrome_repack_locales.gypi | 8 | ||||
-rw-r--r-- | chrome/chrome_resources.gyp | 6 | ||||
-rwxr-xr-x | chrome/tools/build/repack_locales.py | 11 | ||||
-rwxr-xr-x | chrome/tools/check_grd_for_unused_strings.py | 3 |
11 files changed, 63 insertions, 28 deletions
diff --git a/chrome/browser/chromeos/status/network_menu.cc b/chrome/browser/chromeos/status/network_menu.cc index 63b48d7..8f4c81a 100644 --- a/chrome/browser/chromeos/status/network_menu.cc +++ b/chrome/browser/chromeos/status/network_menu.cc @@ -9,7 +9,6 @@ #include "ash/shell.h" #include "ash/shell_delegate.h" #include "ash/system/chromeos/network/network_connect.h" -#include "ash/system/chromeos/network/network_icon.h" #include "base/bind.h" #include "base/logging.h" #include "base/strings/stringprintf.h" @@ -32,6 +31,7 @@ #include "ui/base/l10n/l10n_util.h" #include "ui/base/models/menu_model.h" #include "ui/base/resource/resource_bundle.h" +#include "ui/chromeos/network/network_icon.h" #include "ui/gfx/image/image_skia.h" namespace chromeos { @@ -363,8 +363,8 @@ void MainMenuModel::AddWirelessNetworkMenuItem(const NetworkState* network, if (ShouldHighlightNetwork(network)) flag |= FLAG_ASSOCIATED; - const gfx::ImageSkia icon = ash::network_icon::GetImageForNetwork( - network, ash::network_icon::ICON_TYPE_LIST); + const gfx::ImageSkia icon = ui::network_icon::GetImageForNetwork( + network, ui::network_icon::ICON_TYPE_LIST); menu_items_.push_back( MenuItem(ui::MenuModel::TYPE_COMMAND, label, icon, network->path(), flag)); @@ -403,8 +403,8 @@ void MainMenuModel::InitMenuItems(bool should_open_button_options) { int flag = FLAG_ETHERNET; if (ShouldHighlightNetwork(ethernet_network)) flag |= FLAG_ASSOCIATED; - const gfx::ImageSkia icon = ash::network_icon::GetImageForNetwork( - ethernet_network, ash::network_icon::ICON_TYPE_LIST); + const gfx::ImageSkia icon = ui::network_icon::GetImageForNetwork( + ethernet_network, ui::network_icon::ICON_TYPE_LIST); menu_items_.push_back(MenuItem(ui::MenuModel::TYPE_COMMAND, label, icon, std::string(), flag)); } @@ -444,8 +444,8 @@ void MainMenuModel::InitMenuItems(bool should_open_button_options) { bool isActive = ShouldHighlightNetwork(network); if (isActive) flag |= FLAG_ASSOCIATED; - const gfx::ImageSkia icon = ash::network_icon::GetImageForNetwork( - network, ash::network_icon::ICON_TYPE_LIST); + const gfx::ImageSkia icon = ui::network_icon::GetImageForNetwork( + network, ui::network_icon::ICON_TYPE_LIST); menu_items_.push_back( MenuItem(ui::MenuModel::TYPE_COMMAND, label, icon, network->path(), flag)); @@ -456,8 +456,8 @@ void MainMenuModel::InitMenuItems(bool should_open_button_options) { handler->GetDeviceStateByType(NetworkTypePattern::Cellular()); if (cellular_device && cellular_device->support_network_scan()) { const gfx::ImageSkia icon = - ash::network_icon::GetImageForDisconnectedNetwork( - ash::network_icon::ICON_TYPE_LIST, shill::kTypeCellular); + ui::network_icon::GetImageForDisconnectedNetwork( + ui::network_icon::ICON_TYPE_LIST, shill::kTypeCellular); menu_items_.push_back(MenuItem( ui::MenuModel::TYPE_COMMAND, l10n_util::GetStringUTF16( @@ -466,7 +466,7 @@ void MainMenuModel::InitMenuItems(bool should_open_button_options) { } } else { int initializing_message_id = - ash::network_icon::GetCellularUninitializedMsg(); + ui::network_icon::GetCellularUninitializedMsg(); if (initializing_message_id) { // Initializing cellular modem... AddMessageItem(l10n_util::GetStringUTF16(initializing_message_id)); @@ -505,9 +505,8 @@ void MainMenuModel::InitMenuItems(bool should_open_button_options) { } if (scanning_msg) AddMessageItem(l10n_util::GetStringUTF16(scanning_msg)); - const gfx::ImageSkia icon = - ash::network_icon::GetImageForConnectedNetwork( - ash::network_icon::ICON_TYPE_LIST, shill::kTypeWifi); + const gfx::ImageSkia icon = ui::network_icon::GetImageForConnectedNetwork( + ui::network_icon::ICON_TYPE_LIST, shill::kTypeWifi); menu_items_.push_back(MenuItem( ui::MenuModel::TYPE_COMMAND, l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_OTHER_WIFI_NETWORKS), diff --git a/chrome/browser/ui/webui/chromeos/login/network_dropdown.cc b/chrome/browser/ui/webui/chromeos/login/network_dropdown.cc index 19fe7ed..15e5128 100644 --- a/chrome/browser/ui/webui/chromeos/login/network_dropdown.cc +++ b/chrome/browser/ui/webui/chromeos/login/network_dropdown.cc @@ -6,8 +6,6 @@ #include <string> -#include "ash/system/chromeos/network/network_icon.h" -#include "ash/system/chromeos/network/network_icon_animation.h" #include "base/time/time.h" #include "base/values.h" #include "chrome/browser/chromeos/login/ui/login_display_host.h" @@ -16,6 +14,8 @@ #include "content/public/browser/web_ui.h" #include "ui/base/models/menu_model.h" #include "ui/base/webui/web_ui_util.h" +#include "ui/chromeos/network/network_icon.h" +#include "ui/chromeos/network/network_icon_animation.h" #include "ui/gfx/font_list.h" #include "ui/gfx/image/image.h" #include "ui/gfx/image/image_skia.h" @@ -128,7 +128,7 @@ NetworkDropdown::NetworkDropdown(Actor* actor, } NetworkDropdown::~NetworkDropdown() { - ash::network_icon::NetworkIconAnimation::GetInstance()->RemoveObserver(this); + ui::network_icon::NetworkIconAnimation::GetInstance()->RemoveObserver(this); if (NetworkHandler::IsInitialized()) { NetworkHandler::Get()->network_state_handler()->RemoveObserver( this, FROM_HERE); @@ -182,13 +182,12 @@ void NetworkDropdown::SetNetworkIconAndText() { base::string16 text; gfx::ImageSkia icon_image; bool animating = false; - ash::network_icon::GetDefaultNetworkImageAndLabel( - ash::network_icon::ICON_TYPE_LIST, &icon_image, &text, &animating); + ui::network_icon::GetDefaultNetworkImageAndLabel( + ui::network_icon::ICON_TYPE_LIST, &icon_image, &text, &animating); if (animating) { - ash::network_icon::NetworkIconAnimation::GetInstance()->AddObserver(this); + ui::network_icon::NetworkIconAnimation::GetInstance()->AddObserver(this); } else { - ash::network_icon::NetworkIconAnimation::GetInstance()-> - RemoveObserver(this); + ui::network_icon::NetworkIconAnimation::GetInstance()->RemoveObserver(this); } SkBitmap icon_bitmap = icon_image.GetRepresentation( web_ui_->GetDeviceScaleFactor()).sk_bitmap(); diff --git a/chrome/browser/ui/webui/chromeos/login/network_dropdown.h b/chrome/browser/ui/webui/chromeos/login/network_dropdown.h index 56b6ec9..f7d798f 100644 --- a/chrome/browser/ui/webui/chromeos/login/network_dropdown.h +++ b/chrome/browser/ui/webui/chromeos/login/network_dropdown.h @@ -5,11 +5,11 @@ #ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_NETWORK_DROPDOWN_H_ #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_NETWORK_DROPDOWN_H_ -#include "ash/system/chromeos/network/network_icon_animation_observer.h" #include "base/basictypes.h" #include "base/timer/timer.h" #include "chrome/browser/chromeos/status/network_menu.h" #include "chromeos/network/network_state_handler_observer.h" +#include "ui/chromeos/network/network_icon_animation_observer.h" #include "ui/gfx/native_widget_types.h" namespace content { @@ -24,7 +24,7 @@ class NetworkState; // Class which implements network dropdown menu using WebUI. class NetworkDropdown : public NetworkMenu::Delegate, public NetworkStateHandlerObserver, - public ash::network_icon::AnimationObserver { + public ui::network_icon::AnimationObserver { public: class Actor { public: diff --git a/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc b/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc index 4d2bdc7..4254352 100644 --- a/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc +++ b/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc @@ -11,7 +11,6 @@ #include <vector> #include "ash/system/chromeos/network/network_connect.h" -#include "ash/system/chromeos/network/network_icon.h" #include "base/basictypes.h" #include "base/bind.h" #include "base/bind_helpers.h" @@ -52,9 +51,11 @@ #include "content/public/browser/web_contents.h" #include "content/public/browser/web_ui.h" #include "grit/ash_resources.h" +#include "grit/ui_chromeos_resources.h" #include "third_party/cros_system_api/dbus/service_constants.h" #include "ui/base/resource/resource_bundle.h" #include "ui/base/webui/web_ui_util.h" +#include "ui/chromeos/network/network_icon.h" #include "ui/gfx/image/image_skia.h" namespace chromeos { @@ -227,8 +228,8 @@ base::DictionaryValue* BuildNetworkDictionary( profile_prefs, g_browser_process->local_state(), *network); network_info->SetBoolean(kNetworkInfoKeyPolicyManaged, has_policy); - std::string icon_url = ash::network_icon::GetImageUrlForNetwork( - network, ash::network_icon::ICON_TYPE_LIST, icon_scale_factor); + std::string icon_url = ui::network_icon::GetImageUrlForNetwork( + network, ui::network_icon::ICON_TYPE_LIST, icon_scale_factor); network_info->SetString(kNetworkInfoKeyIconURL, icon_url); network_info->SetString(kNetworkInfoKeyServicePath, network->path()); diff --git a/chrome/chrome_browser_ui.gypi b/chrome/chrome_browser_ui.gypi index 5de4f93..dc291e9 100644 --- a/chrome/chrome_browser_ui.gypi +++ b/chrome/chrome_browser_ui.gypi @@ -2680,6 +2680,8 @@ 'sources': [ '<@(chrome_browser_ui_chromeos_sources)' ], 'dependencies': [ 'browser_chromeos', + '../ui/chromeos/ui_chromeos.gyp:ui_chromeos', + '../ui/chromeos/ui_chromeos.gyp:ui_chromeos_resources', ], }, { 'sources': [ '<@(chrome_browser_ui_non_chromeos_sources)' ], diff --git a/chrome/chrome_repack_chrome_100_percent.gypi b/chrome/chrome_repack_chrome_100_percent.gypi index 6fafa7b..8f282d4 100644 --- a/chrome/chrome_repack_chrome_100_percent.gypi +++ b/chrome/chrome_repack_chrome_100_percent.gypi @@ -22,6 +22,11 @@ '<(SHARED_INTERMEDIATE_DIR)/ash/resources/ash_resources_100_percent.pak', ], }], + ['chromeos==1', { + 'pak_inputs': [ + '<(SHARED_INTERMEDIATE_DIR)/ui/chromeos/resources/ui_chromeos_resources_100_percent.pak', + ], + }], ], }, 'includes': [ '../build/repack_action.gypi' ], diff --git a/chrome/chrome_repack_chrome_200_percent.gypi b/chrome/chrome_repack_chrome_200_percent.gypi index e903d6b..b086d25 100644 --- a/chrome/chrome_repack_chrome_200_percent.gypi +++ b/chrome/chrome_repack_chrome_200_percent.gypi @@ -22,6 +22,11 @@ '<(SHARED_INTERMEDIATE_DIR)/ash/resources/ash_resources_200_percent.pak', ], }], + ['chromeos==1', { + 'pak_inputs': [ + '<(SHARED_INTERMEDIATE_DIR)/ui/chromeos/resources/ui_chromeos_resources_200_percent.pak', + ], + }], ], }, 'includes': [ '../build/repack_action.gypi' ], diff --git a/chrome/chrome_repack_locales.gypi b/chrome/chrome_repack_locales.gypi index fc70f74..2f47429 100644 --- a/chrome/chrome_repack_locales.gypi +++ b/chrome/chrome_repack_locales.gypi @@ -14,11 +14,16 @@ }, { # else: branding!="Chrome" 'branding_flag': ['-b', 'chromium',], }], + ['chromeos==1', { + 'chromeos_flag': ['--chromeos=1'], + }, { + 'chromeos_flag': ['--chromeos=0'], + }], ], }, 'inputs': [ '<(repack_locales_path)', - '<!@pymod_do_main(repack_locales -i -p <(OS) <(branding_flag) -g <(grit_out_dir) -s <(SHARED_INTERMEDIATE_DIR) -x <(SHARED_INTERMEDIATE_DIR) --use-ash <(use_ash) --enable-autofill-dialog <(enable_autofill_dialog) <(pak_locales))' + '<!@pymod_do_main(repack_locales -i -p <(OS) <(branding_flag) -g <(grit_out_dir) -s <(SHARED_INTERMEDIATE_DIR) -x <(SHARED_INTERMEDIATE_DIR) --use-ash <(use_ash) <(chromeos_flag) --enable-autofill-dialog <(enable_autofill_dialog) <(pak_locales))' ], 'outputs': [ '<!@pymod_do_main(repack_locales -o -p <(OS) -g <(grit_out_dir) -s <(SHARED_INTERMEDIATE_DIR) -x <(SHARED_INTERMEDIATE_DIR) <(pak_locales))' @@ -32,6 +37,7 @@ '-s', '<(SHARED_INTERMEDIATE_DIR)', '-x', '<(SHARED_INTERMEDIATE_DIR)/.', '--use-ash=<(use_ash)', + '<@(chromeos_flag)', '--enable-autofill-dialog=<(enable_autofill_dialog)', '<@(repack_options)', '<@(pak_locales)', diff --git a/chrome/chrome_resources.gyp b/chrome/chrome_resources.gyp index a166312..a405ef9 100644 --- a/chrome/chrome_resources.gyp +++ b/chrome/chrome_resources.gyp @@ -453,6 +453,12 @@ '<(DEPTH)/ash/ash_strings.gyp:ash_strings', ], }], + ['chromeos==1', { + 'dependencies': [ + '<(DEPTH)/ui/chromeos/ui_chromeos.gyp:ui_chromeos_resources', + '<(DEPTH)/ui/chromeos/ui_chromeos.gyp:ui_chromeos_strings', + ], + }], ['enable_autofill_dialog==1 and OS!="android"', { 'dependencies': [ '<(DEPTH)/third_party/libaddressinput/libaddressinput.gyp:libaddressinput_strings', diff --git a/chrome/tools/build/repack_locales.py b/chrome/tools/build/repack_locales.py index 977d142..9d3ce20 100755 --- a/chrome/tools/build/repack_locales.py +++ b/chrome/tools/build/repack_locales.py @@ -29,6 +29,9 @@ INT_DIR = None # The target platform. If it is not defined, sys.platform will be used. OS = None +# Note that OS is normally set to 'linux' when building for chromeos. +CHROMEOS = False + USE_ASH = False ENABLE_AUTOFILL_DIALOG = False @@ -84,6 +87,10 @@ def calc_inputs(locale): inputs.append(os.path.join(SHARE_INT_DIR, 'ash', 'strings', 'ash_strings_%s.pak' % locale)) + if CHROMEOS: + inputs.append(os.path.join(SHARE_INT_DIR, 'ui', 'chromeos', 'strings', + 'ui_chromeos_strings_%s.pak' % locale)) + if OS != 'ios': #e.g. '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_da.pak' inputs.append(os.path.join(SHARE_INT_DIR, 'webkit', @@ -171,6 +178,7 @@ def DoMain(argv): global SHARE_INT_DIR global INT_DIR global OS + global CHROMEOS global USE_ASH global WHITELIST global ENABLE_AUTOFILL_DIALOG @@ -196,6 +204,8 @@ def DoMain(argv): help="The target OS. (e.g. mac, linux, win, etc.)") parser.add_option("--use-ash", action="store", dest="use_ash", help="Whether to include ash strings") + parser.add_option("--chromeos", action="store", + help="Whether building for Chrome OS") parser.add_option("--whitelist", action="store", help="Full path to the " "whitelist used to filter output pak file resource IDs") parser.add_option("--enable-autofill-dialog", action="store", @@ -214,6 +224,7 @@ def DoMain(argv): BRANDING = options.branding EXTRA_INPUT_FILES = options.extra_input OS = options.os + CHROMEOS = options.chromeos == '1' USE_ASH = options.use_ash == '1' WHITELIST = options.whitelist ENABLE_AUTOFILL_DIALOG = options.enable_autofill_dialog == '1' diff --git a/chrome/tools/check_grd_for_unused_strings.py b/chrome/tools/check_grd_for_unused_strings.py index 2ff3c90..25455f8 100755 --- a/chrome/tools/check_grd_for_unused_strings.py +++ b/chrome/tools/check_grd_for_unused_strings.py @@ -133,6 +133,7 @@ def main(): device_base_dir = os.path.join(src_dir, 'device') ui_base_dir = os.path.join(src_dir, 'ui', 'base',) ui_base_strings_dir = os.path.join(ui_base_dir, 'strings') + ui_chromeos_dir = os.path.join(ui_base_dir, 'chromeos', 'strings') grd_files = [ os.path.join(ash_base_dir, 'ash_strings.grd'), os.path.join(ash_base_dir, 'resources', 'ash_resources.grd'), @@ -156,6 +157,7 @@ def main(): os.path.join(src_dir, 'ui', 'webui', 'resources', 'webui_resources.grd'), os.path.join(ui_base_strings_dir, 'app_locale_settings.grd'), os.path.join(ui_base_strings_dir, 'ui_strings.grd'), + os.path.join(ui_chromeos_dir, 'ui_chromeos_strings.grd'), ] # If no source directories were given, default them: @@ -169,7 +171,6 @@ def main(): os.path.join(src_dir, 'device'), os.path.join(src_dir, 'extensions'), os.path.join(src_dir, 'ui'), - os.path.join(src_dir, 'views'), # nsNSSCertHelper.cpp has a bunch of ids os.path.join(src_dir, 'third_party', 'mozilla_security_manager'), os.path.join(chrome_dir, 'installer'), |