diff --git a/ash/DEPS b/ash/DEPS index 5811123346c2a9..dd4c67fe055cae 100644 --- a/ash/DEPS +++ b/ash/DEPS @@ -1,4 +1,5 @@ include_rules = [ + "+grit/ash_strings.h", "+grit/ui_resources.h", "+grit/ui_resources_standard.h", "+grit/ui_resources_large.h", diff --git a/ash/ash.gyp b/ash/ash.gyp index bc3b70e31d9bdd..8862ce45cfcf70 100644 --- a/ash/ash.gyp +++ b/ash/ash.gyp @@ -13,6 +13,7 @@ 'target_name': 'ash', 'type': '<(component)', 'dependencies': [ + 'ash_strings.gyp:ash_strings', '../base/base.gyp:base', '../base/base.gyp:base_i18n', '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', diff --git a/ash/ash_strings.grd b/ash/ash_strings.grd new file mode 100644 index 00000000000000..5b08178e07a6e8 --- /dev/null +++ b/ash/ash_strings.grd @@ -0,0 +1,128 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Applications + + + Window Cycler + + + Overflow Button + + + + + diff --git a/ash/ash_strings.gyp b/ash/ash_strings.gyp new file mode 100644 index 00000000000000..4b09ad25101e02 --- /dev/null +++ b/ash/ash_strings.gyp @@ -0,0 +1,32 @@ +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'variables': { + 'grit_out_dir': '<(SHARED_INTERMEDIATE_DIR)/chrome', + }, + + 'targets': [ + { + 'target_name': 'ash_strings', + 'type': 'none', + 'actions': [ + # Localizable resources. + { + 'action_name': 'ash_strings', + 'variables': { + 'grit_grd_file': 'ash_strings.grd', + 'grit_out_dir': '<(SHARED_INTERMEDIATE_DIR)/ash_strings', + }, + 'includes': [ '../build/grit_action.gypi' ], + }, + ], + 'direct_dependent_settings': { + 'include_dirs': [ + '<(SHARED_INTERMEDIATE_DIR)/ash_strings', + ], + }, + }, + ], +} diff --git a/ash/launcher/app_launcher_button.cc b/ash/launcher/app_launcher_button.cc index ae23d19983d5f2..cc732550425c72 100644 --- a/ash/launcher/app_launcher_button.cc +++ b/ash/launcher/app_launcher_button.cc @@ -7,6 +7,7 @@ #include #include "ash/launcher/launcher_button_host.h" +#include "ui/base/accessibility/accessible_view_state.h" #include "ui/gfx/canvas_skia.h" namespace ash { @@ -81,5 +82,10 @@ void AppLauncherButton::OnMouseExited(const views::MouseEvent& event) { host_->MouseExitedButton(this); } +void AppLauncherButton::GetAccessibleState(ui::AccessibleViewState* state) { + state->role = ui::AccessibilityTypes::ROLE_PUSHBUTTON; + state->name = host_->GetAccessibleName(this); +} + } // namespace internal } // namespace ash diff --git a/ash/launcher/app_launcher_button.h b/ash/launcher/app_launcher_button.h index 808406204f82cc..bcd4f8c1a5cc4f 100644 --- a/ash/launcher/app_launcher_button.h +++ b/ash/launcher/app_launcher_button.h @@ -31,6 +31,7 @@ class AppLauncherButton : public views::ImageButton { virtual void OnMouseCaptureLost() OVERRIDE; virtual bool OnMouseDragged(const views::MouseEvent& event) OVERRIDE; virtual void OnMouseExited(const views::MouseEvent& event) OVERRIDE; + virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; private: LauncherButtonHost* host_; diff --git a/ash/launcher/launcher_button_host.h b/ash/launcher/launcher_button_host.h index 1cc94614a423ca..2c8138552f9a3d 100644 --- a/ash/launcher/launcher_button_host.h +++ b/ash/launcher/launcher_button_host.h @@ -6,6 +6,8 @@ #define ASH_LAUNCHER_LAUNCHER_BUTTON_HOST_H_ #pragma once +#include "base/string16.h" + namespace views { class MouseEvent; class View; @@ -33,6 +35,9 @@ class LauncherButtonHost { // Invoked when the mouse exits the item. virtual void MouseExitedButton(views::View* view) = 0; + // Invoked to get the accessible name of the item. + virtual string16 GetAccessibleName(views::View* view) = 0; + protected: virtual ~LauncherButtonHost() {} }; diff --git a/ash/launcher/launcher_view.cc b/ash/launcher/launcher_view.cc index d674bb343f3ed6..ec93a280f8fa34 100644 --- a/ash/launcher/launcher_view.cc +++ b/ash/launcher/launcher_view.cc @@ -13,10 +13,12 @@ #include "ash/shell.h" #include "ash/shell_delegate.h" #include "base/utf_string_conversions.h" +#include "grit/ash_strings.h" #include "grit/ui_resources.h" #include "ui/aura/window.h" #include "ui/base/animation/animation.h" #include "ui/base/animation/throb_animation.h" +#include "ui/base/l10n/l10n_util.h" #include "ui/base/models/simple_menu_model.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/compositor/layer.h" @@ -643,5 +645,28 @@ void LauncherView::ButtonPressed(views::Button* sender, } } +string16 LauncherView::GetAccessibleName(views::View* view) { + ShellDelegate* delegate = Shell::GetInstance()->delegate(); + if (!delegate) + return string16(); + int view_index = view_model_->GetIndexOfView(view); + // May be -1 while in the process of animating closed. + if (view_index == -1) + return string16(); + + switch (model_->items()[view_index].type) { + case TYPE_TABBED: + case TYPE_APP: + return delegate->GetLauncherItemTitle(model_->items()[view_index]); + + case TYPE_APP_LIST: + return l10n_util::GetStringUTF16(IDS_AURA_APP_LIST_TITLE); + + case TYPE_BROWSER_SHORTCUT: + return l10n_util::GetStringUTF16(IDS_AURA_CYCLER_TITLE); + } + return string16(); +} + } // namespace internal } // namespace ash diff --git a/ash/launcher/launcher_view.h b/ash/launcher/launcher_view.h index 4e41be5ea00bfb..f43e3695bbcf8a 100644 --- a/ash/launcher/launcher_view.h +++ b/ash/launcher/launcher_view.h @@ -109,6 +109,7 @@ class LauncherView : public views::WidgetDelegateView, virtual void MouseReleasedOnButton(views::View* view, bool canceled) OVERRIDE; virtual void MouseExitedButton(views::View* view) OVERRIDE; + virtual string16 GetAccessibleName(views::View* view) OVERRIDE; // Overriden from views::ButtonListener: virtual void ButtonPressed(views::Button* sender, diff --git a/ash/launcher/tabbed_launcher_button.cc b/ash/launcher/tabbed_launcher_button.cc index 09da1a92c9c792..84d061ed678598 100644 --- a/ash/launcher/tabbed_launcher_button.cc +++ b/ash/launcher/tabbed_launcher_button.cc @@ -8,6 +8,7 @@ #include "ash/launcher/launcher_button_host.h" #include "grit/ui_resources.h" +#include "ui/base/accessibility/accessible_view_state.h" #include "ui/base/animation/multi_animation.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/canvas.h" @@ -162,6 +163,11 @@ void TabbedLauncherButton::OnMouseExited(const views::MouseEvent& event) { hover_controller_.Hide(); } +void TabbedLauncherButton::GetAccessibleState(ui::AccessibleViewState* state) { + state->role = ui::AccessibilityTypes::ROLE_PUSHBUTTON; + state->name = host_->GetAccessibleName(this); +} + // static TabbedLauncherButton::ImageSet* TabbedLauncherButton::CreateImageSet( int normal_id, diff --git a/ash/launcher/tabbed_launcher_button.h b/ash/launcher/tabbed_launcher_button.h index c950a11a880bf5..44917b7f76290d 100644 --- a/ash/launcher/tabbed_launcher_button.h +++ b/ash/launcher/tabbed_launcher_button.h @@ -44,6 +44,7 @@ class TabbedLauncherButton : public views::ImageButton { virtual void OnMouseEntered(const views::MouseEvent& event) OVERRIDE; virtual void OnMouseMoved(const views::MouseEvent& event) OVERRIDE; virtual void OnMouseExited(const views::MouseEvent& event) OVERRIDE; + virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; private: // Used as the delegate for |animation_|. TabbedLauncherButton doesn't diff --git a/chrome/chrome_resources.gyp b/chrome/chrome_resources.gyp index 29227c7fde3a55..45c441bf6b4ec3 100644 --- a/chrome/chrome_resources.gyp +++ b/chrome/chrome_resources.gyp @@ -269,6 +269,8 @@ 'chrome_strings', 'platform_locale_settings', 'theme_resources', + # TODO(zork): Protect this with if use_aura==1 + '<(DEPTH)/ash/ash_strings.gyp:ash_strings', '<(DEPTH)/content/content_resources.gyp:content_resources', '<(DEPTH)/net/net.gyp:net_resources', '<(DEPTH)/ui/base/strings/ui_strings.gyp:ui_strings', diff --git a/chrome/tools/build/repack_locales.py b/chrome/tools/build/repack_locales.py index a1db528343f815..3903805ee82f1a 100755 --- a/chrome/tools/build/repack_locales.py +++ b/chrome/tools/build/repack_locales.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright (c) 2011 The Chromium Authors. All rights reserved. +# Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. @@ -72,6 +72,10 @@ def calc_inputs(locale): inputs.append(os.path.join(SHARE_INT_DIR, 'ui', 'ui_strings', 'ui_strings_%s.pak' % locale)) + #e.g. '<(SHARED_INTERMEDIATE_DIR)/ash_strings/ash_strings_da.pak', + inputs.append(os.path.join(SHARE_INT_DIR, 'ash_strings', + 'ash_strings_%s.pak' % locale)) + #e.g. '<(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings_da.pak', inputs.append(os.path.join(SHARE_INT_DIR, 'ui', 'app_locale_settings', 'app_locale_settings_%s.pak' % locale)) diff --git a/chrome/tools/check_grd_for_unused_strings.py b/chrome/tools/check_grd_for_unused_strings.py index 1f51272af29dc2..ec69f876fcd474 100755 --- a/chrome/tools/check_grd_for_unused_strings.py +++ b/chrome/tools/check_grd_for_unused_strings.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright (c) 2011 The Chromium Authors. All rights reserved. +# Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. @@ -126,11 +126,13 @@ def main(): # If no GRD files were given, default them: if len(grd_files) == 0: + ash_base_dir = os.path.join(src_dir, 'ash') chrome_dir = os.path.join(src_dir, 'chrome') chrome_app_dir = os.path.join(chrome_dir, 'app') chrome_app_res_dir = os.path.join(chrome_app_dir, 'resources') ui_base_dir = os.path.join(src_dir, 'ui', 'base', 'strings') grd_files = [ + os.path.join(ash_base_dir, 'ash_strings.grd'), os.path.join(chrome_app_dir, 'chromium_strings.grd'), os.path.join(chrome_app_dir, 'generated_resources.grd'), os.path.join(chrome_app_dir, 'google_chrome_strings.grd'), diff --git a/tools/gritsettings/resource_ids b/tools/gritsettings/resource_ids index 35d985c90400a2..d6c386d91debc9 100644 --- a/tools/gritsettings/resource_ids +++ b/tools/gritsettings/resource_ids @@ -178,4 +178,7 @@ "content/shell/shell_resources.grd": { "includes": [25000], }, + "ash/ash_strings.grd": { + "messages": [25500], + }, }