summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/status/input_method_menu_button.cc
diff options
context:
space:
mode:
authorsadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-11 17:53:33 +0000
committersadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-11 17:53:33 +0000
commit4801879ec26e37c437ab8b9c3f96067a2e0afcb7 (patch)
tree55a6866acd28fd4bcd4ac0e9ca53b31e22f0e759 /chrome/browser/chromeos/status/input_method_menu_button.cc
parentf8742e3ba254518bc11409f7b31288eb6a2e4e5a (diff)
downloadchromium_src-4801879ec26e37c437ab8b9c3f96067a2e0afcb7.zip
chromium_src-4801879ec26e37c437ab8b9c3f96067a2e0afcb7.tar.gz
chromium_src-4801879ec26e37c437ab8b9c3f96067a2e0afcb7.tar.bz2
chromeos: Remove old status-area related code.
This removes --disable-ash-uber-tray from command-line and chrome://flags, and much of the code that becomes extinct because of this. BUG=122295 TEST=none Review URL: https://chromiumcodereview.appspot.com/10056001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@131801 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos/status/input_method_menu_button.cc')
-rw-r--r--chrome/browser/chromeos/status/input_method_menu_button.cc158
1 files changed, 0 insertions, 158 deletions
diff --git a/chrome/browser/chromeos/status/input_method_menu_button.cc b/chrome/browser/chromeos/status/input_method_menu_button.cc
deleted file mode 100644
index 6b2f027..0000000
--- a/chrome/browser/chromeos/status/input_method_menu_button.cc
+++ /dev/null
@@ -1,158 +0,0 @@
-// 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.
-
-#include "chrome/browser/chromeos/status/input_method_menu_button.h"
-
-#include <string>
-
-#include "base/utf_string_conversions.h"
-#include "chrome/browser/chromeos/input_method/input_method_manager.h"
-#include "chrome/browser/chromeos/input_method/input_method_util.h"
-#include "chrome/browser/chromeos/status/status_area_view_chromeos.h"
-#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_list.h"
-#include "chrome/browser/ui/browser_window.h"
-#include "ui/views/widget/widget.h"
-
-namespace {
-
-// A class which implements interfaces of chromeos::InputMethodMenu. This class
-// is just for avoiding multiple inheritance.
-class MenuImpl : public chromeos::InputMethodMenu {
- public:
- explicit MenuImpl(chromeos::InputMethodMenuButton* button)
- : button_(button) {}
-
- private:
- // InputMethodMenu implementation.
- virtual void UpdateUI(const std::string& input_method_id,
- const string16& name,
- const string16& tooltip,
- size_t num_active_input_methods) {
- button_->UpdateUI(input_method_id, name, tooltip, num_active_input_methods);
- }
- virtual bool ShouldSupportConfigUI() {
- return button_->ShouldSupportConfigUI();
- }
- virtual void OpenConfigUI() {
- button_->OpenConfigUI();
- }
- // The UI (views button) to which this class delegates all requests.
- chromeos::InputMethodMenuButton* button_;
-
- DISALLOW_COPY_AND_ASSIGN(MenuImpl);
-};
-
-} // namespace
-
-namespace chromeos {
-
-////////////////////////////////////////////////////////////////////////////////
-// InputMethodMenuButton
-
-InputMethodMenuButton::InputMethodMenuButton(
- StatusAreaButton::Delegate* delegate)
- : StatusAreaButton(delegate, this),
- menu_(new MenuImpl(this)) {
- set_id(VIEW_ID_STATUS_BUTTON_INPUT_METHOD);
- UpdateUIFromCurrentInputMethod();
-}
-
-InputMethodMenuButton::~InputMethodMenuButton() {}
-
-////////////////////////////////////////////////////////////////////////////////
-// views::View implementation:
-
-void InputMethodMenuButton::OnLocaleChanged() {
- input_method::InputMethodManager* manager =
- input_method::InputMethodManager::GetInstance();
- manager->GetInputMethodUtil()->OnLocaleChanged();
- UpdateUIFromCurrentInputMethod();
- Layout();
- SchedulePaint();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// views::MenuButtonListener implementation:
-
-void InputMethodMenuButton::OnMenuButtonClicked(views::View* source,
- const gfx::Point& point) {
- menu_->OnMenuButtonClicked(source, point);
-}
-
-bool InputMethodMenuButton::StatusAreaIsVisible() {
-#if defined(USE_ASH)
- return true;
-#else
- Browser* active_browser = BrowserList::GetLastActive();
- if (!active_browser) {
- // Can't get an active browser. Just return true, which is safer.
- return true;
- }
- BrowserWindow* active_window = active_browser->window();
- const views::Widget* current_window = GetWidget();
- if (!active_window || !current_window) {
- // Can't get an active or current window. Just return true as well.
- return true;
- }
- return active_window->GetNativeHandle() == current_window->GetNativeWindow();
-#endif
-}
-
-void InputMethodMenuButton::UpdateUI(const std::string& input_method_id,
- const string16& name,
- const string16& tooltip,
- size_t num_active_input_methods) {
- // Hide the button only if there is only one input method, and the input
- // method is a XKB keyboard layout. We don't hide the button for other
- // types of input methods as these might have intra input method modes,
- // like Hiragana and Katakana modes in Japanese input methods.
- const bool hide_button =
- num_active_input_methods == 1 &&
- input_method::InputMethodUtil::IsKeyboardLayout(input_method_id) &&
- StatusAreaViewChromeos::IsBrowserMode();
- SetVisible(!hide_button);
- SetText(name);
- SetTooltipText(tooltip);
- SetAccessibleName(tooltip);
-
- if (StatusAreaIsVisible()) {
- // We don't call these functions if the |current_window| is not active since
- // the calls are relatively expensive (crosbug.com/9206). Please note that
- // PrepareMenuModel() is necessary for fixing crosbug.com/7522 when the
- // window is active.
- menu_->PrepareMenuModel();
- SchedulePaint();
- }
-
- // TODO(yusukes): For a window which isn't on top, probably it's better to
- // update the texts when the window gets activated because SetTooltipText()
- // and SetText() are also expensive.
-}
-
-void InputMethodMenuButton::OpenConfigUI() {
- // Ask browser to open the WebUI page.
- delegate()->ExecuteStatusAreaCommand(
- this, StatusAreaButton::Delegate::SHOW_LANGUAGE_OPTIONS);
-}
-
-bool InputMethodMenuButton::ShouldSupportConfigUI() {
- return delegate()->ShouldExecuteStatusAreaCommand(
- this, StatusAreaButton::Delegate::SHOW_LANGUAGE_OPTIONS);
-}
-
-void InputMethodMenuButton::UpdateUIFromCurrentInputMethod() {
- input_method::InputMethodManager* input_method_manager =
- input_method::InputMethodManager::GetInstance();
- const input_method::InputMethodDescriptor& input_method =
- input_method_manager->GetCurrentInputMethod();
- const string16 name = input_method_manager->GetInputMethodUtil()->
- GetInputMethodShortName(input_method);
- const string16 tooltip = InputMethodMenu::GetTextForMenu(input_method);
- const size_t num_active_input_methods =
- input_method_manager->GetNumActiveInputMethods();
- UpdateUI(input_method.id(), name, tooltip, num_active_input_methods);
-}
-
-} // namespace chromeos