Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / ash / system / chromeos / settings / tray_settings.cc
index 432b6aa..8b4c6c9 100644 (file)
@@ -4,6 +4,7 @@
 
 #include "ash/system/chromeos/settings/tray_settings.h"
 
+#include "ash/session/session_state_delegate.h"
 #include "ash/shell.h"
 #include "ash/system/chromeos/power/power_status.h"
 #include "ash/system/chromeos/power/power_status_view.h"
@@ -16,7 +17,6 @@
 #include "grit/ash_resources.h"
 #include "grit/ash_strings.h"
 #include "third_party/skia/include/core/SkColor.h"
-#include "ui/base/accessibility/accessible_view_state.h"
 #include "ui/base/resource/resource_bundle.h"
 #include "ui/gfx/image/image.h"
 #include "ui/views/controls/image_view.h"
@@ -26,8 +26,6 @@
 #include "ui/views/view.h"
 
 namespace ash {
-namespace internal {
-
 namespace tray {
 
 class SettingsDefaultView : public ActionableView,
@@ -43,13 +41,18 @@ class SettingsDefaultView : public ActionableView,
         ash::kTrayPopupPaddingBetweenItems));
 
     bool power_view_right_align = false;
+    bool userAddingRunning = ash::Shell::GetInstance()
+                                 ->session_state_delegate()
+                                 ->IsInSecondaryLoginScreen();
+
     if (login_status_ != user::LOGGED_IN_NONE &&
-        login_status_ != user::LOGGED_IN_LOCKED) {
+        login_status_ != user::LOGGED_IN_LOCKED && !userAddingRunning) {
       ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
       views::ImageView* icon =
-          new ash::internal::FixedSizedImageView(0, ash::kTrayPopupItemHeight);
+          new ash::FixedSizedImageView(0, ash::kTrayPopupItemHeight);
       icon->SetImage(
           rb.GetImageNamed(IDR_AURA_UBER_TRAY_SETTINGS).ToImageSkia());
+      icon->set_id(test::kSettingsTrayItemViewId);
       AddChildView(icon);
 
       base::string16 text = rb.GetLocalizedString(IDS_ASH_STATUS_TRAY_SETTINGS);
@@ -61,8 +64,8 @@ class SettingsDefaultView : public ActionableView,
     }
 
     if (PowerStatus::Get()->IsBatteryPresent()) {
-      power_status_view_ = new ash::internal::PowerStatusView(
-          ash::internal::PowerStatusView::VIEW_DEFAULT, power_view_right_align);
+      power_status_view_ = new ash::PowerStatusView(
+          ash::PowerStatusView::VIEW_DEFAULT, power_view_right_align);
       AddChildView(power_status_view_);
       OnPowerStatusChanged();
     }
@@ -72,10 +75,14 @@ class SettingsDefaultView : public ActionableView,
     PowerStatus::Get()->RemoveObserver(this);
   }
 
-  // Overridden from ash::internal::ActionableView.
-  virtual bool PerformAction(const ui::Event& event) OVERRIDE {
+  // Overridden from ash::ActionableView.
+  virtual bool PerformAction(const ui::Event& event) override {
+    bool userAddingRunning = ash::Shell::GetInstance()
+                                 ->session_state_delegate()
+                                 ->IsInSecondaryLoginScreen();
+
     if (login_status_ == user::LOGGED_IN_NONE ||
-        login_status_ == user::LOGGED_IN_LOCKED)
+        login_status_ == user::LOGGED_IN_LOCKED || userAddingRunning)
       return false;
 
     ash::Shell::GetInstance()->system_tray_delegate()->ShowSettings();
@@ -83,7 +90,7 @@ class SettingsDefaultView : public ActionableView,
   }
 
   // Overridden from views::View.
-  virtual void Layout() OVERRIDE {
+  virtual void Layout() override {
     views::View::Layout();
 
     if (label_ && power_status_view_) {
@@ -98,27 +105,27 @@ class SettingsDefaultView : public ActionableView,
   }
 
   // Overridden from views::View.
-  virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE {
+  virtual void ChildPreferredSizeChanged(views::View* child) override {
     views::View::ChildPreferredSizeChanged(child);
     Layout();
   }
 
   // Overridden from PowerStatus::Observer.
-  virtual void OnPowerStatusChanged() OVERRIDE {
+  virtual void OnPowerStatusChanged() override {
     if (!PowerStatus::Get()->IsBatteryPresent())
       return;
 
     base::string16 accessible_name = label_ ?
         label_->text() + base::ASCIIToUTF16(", ") +
-            PowerStatus::Get()->GetAccessibleNameString() :
-        PowerStatus::Get()->GetAccessibleNameString();
+            PowerStatus::Get()->GetAccessibleNameString(true) :
+        PowerStatus::Get()->GetAccessibleNameString(true);
     SetAccessibleName(accessible_name);
   }
 
  private:
   user::LoginStatus login_status_;
   views::Label* label_;
-  ash::internal::PowerStatusView* power_status_view_;
+  ash::PowerStatusView* power_status_view_;
 
   DISALLOW_COPY_AND_ASSIGN(SettingsDefaultView);
  };
@@ -141,10 +148,8 @@ views::View* TraySettings::CreateDefaultView(user::LoginStatus status) {
   if ((status == user::LOGGED_IN_NONE || status == user::LOGGED_IN_LOCKED) &&
       !PowerStatus::Get()->IsBatteryPresent())
     return NULL;
-
   if (!ash::Shell::GetInstance()->system_tray_delegate()->ShouldShowSettings())
     return NULL;
-
   CHECK(default_view_ == NULL);
   default_view_ =  new tray::SettingsDefaultView(status);
   return default_view_;
@@ -168,5 +173,4 @@ void TraySettings::DestroyDetailedView() {
 void TraySettings::UpdateAfterLoginStatusChange(user::LoginStatus status) {
 }
 
-}  // namespace internal
 }  // namespace ash