summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortengs@chromium.org <tengs@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-22 23:06:07 +0000
committertengs@chromium.org <tengs@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-22 23:06:07 +0000
commit2895276dbab6f4390763fda930ae6775c3e2ad7c (patch)
tree8fa99dafbc21c3eeb9d0227273d15b72b8761e2e
parent28af6fb9ee43290cf5f2d7f651396d77af8cba68 (diff)
downloadchromium_src-2895276dbab6f4390763fda930ae6775c3e2ad7c.zip
chromium_src-2895276dbab6f4390763fda930ae6775c3e2ad7c.tar.gz
chromium_src-2895276dbab6f4390763fda930ae6775c3e2ad7c.tar.bz2
Remove enable Drive offline system tray UI.
BUG=322409 Review URL: https://codereview.chromium.org/83413004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@236859 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--ash/ash.gyp3
-rw-r--r--ash/ash_strings.grd9
-rw-r--r--ash/system/chromeos/drive/tray_drive_notice.cc193
-rw-r--r--ash/system/chromeos/drive/tray_drive_notice.h63
-rw-r--r--ash/system/chromeos/drive/tray_drive_unittest.cc81
-rw-r--r--ash/system/drive/drive_observer.h1
-rw-r--r--ash/system/drive/tray_drive.cc3
-rw-r--r--ash/system/drive/tray_drive.h1
-rw-r--r--ash/system/tray/system_tray.cc2
-rw-r--r--ash/system/tray/system_tray_notifier.cc6
-rw-r--r--ash/system/tray/system_tray_notifier.h1
-rw-r--r--chrome/browser/chromeos/first_run/drive_first_run_controller.cc6
12 files changed, 2 insertions, 367 deletions
diff --git a/ash/ash.gyp b/ash/ash.gyp
index 266bbb5..0d40a16 100644
--- a/ash/ash.gyp
+++ b/ash/ash.gyp
@@ -244,8 +244,6 @@
'system/chromeos/brightness/brightness_controller_chromeos.h',
'system/chromeos/brightness/tray_brightness.cc',
'system/chromeos/brightness/tray_brightness.h',
- 'system/chromeos/drive/tray_drive_notice.cc',
- 'system/chromeos/drive/tray_drive_notice.h',
'system/chromeos/enterprise/tray_enterprise.h',
'system/chromeos/enterprise/tray_enterprise.cc',
'system/chromeos/keyboard_brightness_controller.cc',
@@ -805,7 +803,6 @@
'shell/window_watcher_launcher_item_delegate.h',
'shell/window_watcher_unittest.cc',
'shell_unittest.cc',
- 'system/chromeos/drive/tray_drive_unittest.cc',
'system/chromeos/managed/tray_locally_managed_user_unittest.cc',
'system/chromeos/network/network_state_notifier_unittest.cc',
'system/chromeos/power/power_event_observer_unittest.cc',
diff --git a/ash/ash_strings.grd b/ash/ash_strings.grd
index 3580e7b..289c8b1 100644
--- a/ash/ash_strings.grd
+++ b/ash/ash_strings.grd
@@ -363,15 +363,6 @@ Press Ctrl+Alt+Z to disable.
<message name="IDS_ASH_STATUS_TRAY_DISPLAY_ORIENTATION_270" desc="The value of display orientation option item: 270-degree rotated">
270&#x00B0;
</message>
- <message name="IDS_ASH_STATUS_TRAY_DRIVE_OFFLINE_NOTICE" desc="The label in the tray notifying a first-time logged in user that they are being opted-in to Google Drive offline.">
- Preparing Google Drive for offline...
- </message>
- <message name="IDS_ASH_STATUS_TRAY_DRIVE_DISABLE_OFFLINE" desc="The label in the detailed drive offline opt-in notice tray item explaining how to disable Google Drive offline.">
- To disable Google Drive offline on this device, adjust your settings at drive.google.com.
- </message>
- <message name="IDS_ASH_STATUS_TRAY_DRIVE_OFFLINE_FOOTER" desc="The label for the footer of the detailed drive offline opt-in notice tray item.">
- Google Drive
- </message>
<message name="IDS_ASH_STATUS_TRAY_DRIVE_SYNCING" desc="The label in the tray to indicate onoing file sync operations.">
Syncing <ph name="count">$1<ex>3</ex></ph> file(s)
</message>
diff --git a/ash/system/chromeos/drive/tray_drive_notice.cc b/ash/system/chromeos/drive/tray_drive_notice.cc
deleted file mode 100644
index a48b11b..0000000
--- a/ash/system/chromeos/drive/tray_drive_notice.cc
+++ /dev/null
@@ -1,193 +0,0 @@
-// Copyright 2013 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 "ash/system/chromeos/drive/tray_drive_notice.h"
-
-#include "ash/shell.h"
-#include "ash/system/tray/actionable_view.h"
-#include "ash/system/tray/hover_highlight_view.h"
-#include "ash/system/tray/system_tray.h"
-#include "ash/system/tray/system_tray_delegate.h"
-#include "ash/system/tray/system_tray_notifier.h"
-#include "ash/system/tray/tray_constants.h"
-#include "base/strings/utf_string_conversions.h"
-#include "grit/ash_resources.h"
-#include "grit/ash_strings.h"
-#include "ui/base/l10n/l10n_util.h"
-#include "ui/base/resource/resource_bundle.h"
-#include "ui/views/controls/label.h"
-#include "ui/views/layout/box_layout.h"
-
-namespace ash {
-namespace internal {
-
-namespace {
-
-// Vertical spacing between notice label and the detailed view container.
-const int kNoticeLabelVerticalSpacing = 3;
-
-// Bottom spacing inside border for notice label in detailed view.
-const int kNoticeLabelBorderBottomSpacing = 5;
-
-// The time to show the tray item notice.
-const int kTimeVisibleSeconds = 30;
-
-} // namespace
-
-class DriveNoticeDefaultView : public TrayItemMore {
- public:
- DriveNoticeDefaultView(SystemTrayItem* owner) :
- TrayItemMore(owner, true) {
- ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
- SetImage(bundle.GetImageNamed(IDR_AURA_UBER_TRAY_DRIVE).ToImageSkia());
- SetLabel(
- l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_DRIVE_OFFLINE_NOTICE));
- }
-
- virtual ~DriveNoticeDefaultView() {}
-};
-
-class DriveNoticeDetailedView : public TrayDetailsView,
- public ViewClickListener {
- public:
- DriveNoticeDetailedView(SystemTrayItem* owner)
- : TrayDetailsView(owner),
- settings_button_(NULL) {
- Reset();
-
- CreateScrollableList();
- CreateNoticeLabel();
- CreateSettingsButton();
- CreateSpecialRow(IDS_ASH_STATUS_TRAY_DRIVE_OFFLINE_FOOTER, this);
-
- Layout();
- }
-
- virtual ~DriveNoticeDetailedView() {}
-
- private:
- void CreateNoticeLabel() {
- ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
- views::Label* notice_label = new views::Label(
- rb.GetLocalizedString(IDS_ASH_STATUS_TRAY_DRIVE_DISABLE_OFFLINE));
- notice_label->SetLayoutManager(new views::BoxLayout(
- views::BoxLayout::kHorizontal,
- 0,
- kNoticeLabelVerticalSpacing,
- kTrayPopupPaddingBetweenItems));
- notice_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
- notice_label->SetMultiLine(true);
- notice_label->SetFont(
- notice_label->font().DeriveFont(0, gfx::Font::NORMAL));
-
- int margin = kTrayPopupPaddingHorizontal +
- kTrayPopupDetailsLabelExtraLeftMargin;
- int left_margin = base::i18n::IsRTL() ? 0 : margin;
- int right_margin = base::i18n::IsRTL() ? margin : 0;
- notice_label->set_border(
- views::Border::CreateEmptyBorder(
- kTrayPopupPaddingBetweenItems,
- left_margin,
- kNoticeLabelBorderBottomSpacing,
- right_margin));
-
- scroll_content()->AddChildView(notice_label);
- }
-
- void CreateSettingsButton() {
- HoverHighlightView* redirect_button = new HoverHighlightView(this);
- redirect_button->AddLabel(
- l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_DRIVE_SETTINGS),
- gfx::Font::NORMAL);
- AddChildView(redirect_button);
- settings_button_ = redirect_button;
- }
-
- // Overridden from ViewClickListener.
- virtual void OnViewClicked(views::View* sender) OVERRIDE {
- SystemTrayDelegate* delegate = Shell::GetInstance()->system_tray_delegate();
- if (sender == footer()->content()) {
- owner()->system_tray()->ShowDefaultView(BUBBLE_USE_EXISTING);
- } else if (sender == settings_button_) {
- delegate->ShowDriveSettings();
- }
- }
-
- views::View* settings_button_;
-
- DISALLOW_COPY_AND_ASSIGN(DriveNoticeDetailedView);
-};
-
-TrayDriveNotice::TrayDriveNotice(SystemTray* system_tray)
- : TrayImageItem(system_tray, IDR_AURA_UBER_TRAY_DRIVE_LIGHT),
- default_view_(NULL),
- detailed_view_(NULL),
- showing_item_(false),
- time_visible_secs_(kTimeVisibleSeconds) {
- Shell::GetInstance()->system_tray_notifier()->AddDriveObserver(this);
-}
-
-TrayDriveNotice::~TrayDriveNotice() {
- Shell::GetInstance()->system_tray_notifier()->RemoveDriveObserver(this);
-}
-
-views::View* TrayDriveNotice::GetTrayView() {
- return TrayImageItem::tray_view();
-}
-
-void TrayDriveNotice::SetTimeVisibleForTest(int time_visible_secs) {
- time_visible_secs_ = time_visible_secs;
-}
-
-bool TrayDriveNotice::GetInitialVisibility() {
- return false;
-}
-
-views::View* TrayDriveNotice::CreateDefaultView(user::LoginStatus status) {
- CHECK(default_view_ == NULL);
- if (!showing_item_)
- return NULL;
-
- default_view_ = new DriveNoticeDefaultView(this);
- return default_view_;
-}
-
-views::View* TrayDriveNotice::CreateDetailedView(user::LoginStatus status) {
- if (!showing_item_)
- return NULL;
-
- detailed_view_ = new DriveNoticeDetailedView(this);
- return detailed_view_;
-}
-
-void TrayDriveNotice::DestroyDefaultView() {
- default_view_ = NULL;
-}
-
-void TrayDriveNotice::DestroyDetailedView() {
- detailed_view_ = NULL;
-}
-
-void TrayDriveNotice::UpdateAfterLoginStatusChange(user::LoginStatus status) {
-}
-
-void TrayDriveNotice::OnDriveJobUpdated(const DriveOperationStatus& status) {
-}
-
-void TrayDriveNotice::OnDriveOfflineEnabled() {
- showing_item_ = true;
- tray_view()->SetVisible(true);
- visibility_timer_.Start(FROM_HERE,
- base::TimeDelta::FromSeconds(time_visible_secs_),
- this,
- &TrayDriveNotice::HideNotice);
-}
-
-void TrayDriveNotice::HideNotice() {
- showing_item_ = false;
- tray_view()->SetVisible(false);
-}
-
-} // namespace internal
-} // namespace ash
diff --git a/ash/system/chromeos/drive/tray_drive_notice.h b/ash/system/chromeos/drive/tray_drive_notice.h
deleted file mode 100644
index cbc717d..0000000
--- a/ash/system/chromeos/drive/tray_drive_notice.h
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright 2013 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.
-
-#ifndef ASH_SYSTEM_DRIVE_TRAY_DRIVE_NOTICE_H_
-#define ASH_SYSTEM_DRIVE_TRAY_DRIVE_NOTICE_H_
-
-#include "ash/system/drive/drive_observer.h"
-#include "ash/system/tray/tray_image_item.h"
-#include "ash/system/tray/tray_item_more.h"
-#include "base/timer/timer.h"
-
-namespace ash {
-namespace internal {
-
-class DriveNoticeDetailedView;
-
-// A tray item shown to the user as a notice that Google Drive offline mode has
-// been enabled automatically. This tray item is mainly informational and is
-// automatically dismissed after a short period of time.
-class ASH_EXPORT TrayDriveNotice : public TrayImageItem,
- public DriveObserver {
- public:
- explicit TrayDriveNotice(SystemTray* system_tray);
- virtual ~TrayDriveNotice();
-
- views::View* GetTrayView();
- views::View* default_view() { return default_view_; }
- views::View* detailed_view() { return detailed_view_; }
-
- // Set the time the tray item is visible after opting-in for testing.
- void SetTimeVisibleForTest(int time_visible_secs);
-
- private:
- void HideNotice();
-
- // Overridden from TrayImageItem.
- virtual bool GetInitialVisibility() OVERRIDE;
-
- // Overridden from SystemTrayItem.
- virtual views::View* CreateDefaultView(user::LoginStatus status) OVERRIDE;
- virtual views::View* CreateDetailedView(user::LoginStatus status) OVERRIDE;
- virtual void DestroyDefaultView() OVERRIDE;
- virtual void DestroyDetailedView() OVERRIDE;
- virtual void UpdateAfterLoginStatusChange(user::LoginStatus status) OVERRIDE;
-
- // Overridden from DriveObserver.
- virtual void OnDriveJobUpdated(const DriveOperationStatus& status) OVERRIDE;
- virtual void OnDriveOfflineEnabled() OVERRIDE;
-
- views::View* default_view_;
- views::View* detailed_view_;
- base::OneShotTimer<TrayDriveNotice> visibility_timer_;
- bool showing_item_;
- int time_visible_secs_;
-
- DISALLOW_COPY_AND_ASSIGN(TrayDriveNotice);
-};
-
-} // namespace internal
-} // namespace ash
-
-#endif // ASH_SYSTEM_DRIVE_TRAY_DRIVE_NOTICE_H_
diff --git a/ash/system/chromeos/drive/tray_drive_unittest.cc b/ash/system/chromeos/drive/tray_drive_unittest.cc
deleted file mode 100644
index 439458a..0000000
--- a/ash/system/chromeos/drive/tray_drive_unittest.cc
+++ /dev/null
@@ -1,81 +0,0 @@
-// Copyright 2013 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 "ash/shell.h"
-#include "ash/system/chromeos/drive/tray_drive_notice.h"
-#include "ash/system/tray/system_tray.h"
-#include "ash/system/tray/system_tray_notifier.h"
-#include "ash/system/tray/tray_item_view.h"
-#include "ash/test/ash_test_base.h"
-
-namespace ash {
-namespace internal {
-
-class DriveNoticeTest : public ash::test::AshTestBase {
- public:
- DriveNoticeTest() {}
-
- virtual void SetUp() OVERRIDE {
- test::AshTestBase::SetUp();
- TrayItemView::DisableAnimationsForTest();
-
- // Ownership of |notice_tray_item_| passed to system tray.
- notice_tray_item_ = new TrayDriveNotice(GetSystemTray());
- notice_tray_item_->SetTimeVisibleForTest(0);
- GetSystemTray()->AddTrayItem(notice_tray_item_);
- }
-
- TrayDriveNotice* notice_tray_item() { return notice_tray_item_; }
-
- SystemTray* GetSystemTray() {
- return Shell::GetInstance()->GetPrimarySystemTray();
- }
-
- void NotifyOfflineEnabled() {
- Shell::GetInstance()->system_tray_notifier()->NotifyDriveOfflineEnabled();
- }
-
- private:
- // |notice_tray_item_| is owned by system tray.
- TrayDriveNotice* notice_tray_item_;
-};
-
-TEST_F(DriveNoticeTest, NotifyEnabled) {
- // Tray item views should not be visible initially.
- EXPECT_FALSE(notice_tray_item()->GetTrayView()->visible());
- EXPECT_FALSE(notice_tray_item()->default_view());
- EXPECT_FALSE(notice_tray_item()->detailed_view());
-
- // Tray item view should appear after notifying offline enabled.
- NotifyOfflineEnabled();
- EXPECT_TRUE(notice_tray_item()->GetTrayView()->visible());
-
- // Open system bubble and check default view is visible.
- GetSystemTray()->ShowDefaultView(BUBBLE_CREATE_NEW);
- EXPECT_TRUE(GetSystemTray()->HasSystemBubble());
- EXPECT_TRUE(notice_tray_item()->default_view());
-
- // Open detailed view and check detailed view is visible.
- GetSystemTray()->ShowDetailedView(
- notice_tray_item(), 0, false, BUBBLE_USE_EXISTING);
- EXPECT_TRUE(notice_tray_item()->detailed_view());
-
- GetSystemTray()->CloseSystemBubble();
-}
-
-TEST_F(DriveNoticeTest, AutomaticallyHidden) {
- // The tray item should automatically be hidden after a period of time.
- EXPECT_FALSE(notice_tray_item()->GetTrayView()->visible());
- NotifyOfflineEnabled();
- EXPECT_TRUE(notice_tray_item()->GetTrayView()->visible());
-
- RunAllPendingInMessageLoop();
- EXPECT_FALSE(notice_tray_item()->GetTrayView()->visible());
-
- GetSystemTray()->ShowDefaultView(BUBBLE_CREATE_NEW);
- EXPECT_FALSE(notice_tray_item()->default_view());
-}
-
-} // internal
-} // ash
diff --git a/ash/system/drive/drive_observer.h b/ash/system/drive/drive_observer.h
index b2e7fd8..a721dd4 100644
--- a/ash/system/drive/drive_observer.h
+++ b/ash/system/drive/drive_observer.h
@@ -12,7 +12,6 @@ namespace ash {
class DriveObserver {
public:
virtual void OnDriveJobUpdated(const DriveOperationStatus& status) = 0;
- virtual void OnDriveOfflineEnabled() = 0;
protected:
virtual ~DriveObserver() {}
diff --git a/ash/system/drive/tray_drive.cc b/ash/system/drive/tray_drive.cc
index 7eefa05..028aa29 100644
--- a/ash/system/drive/tray_drive.cc
+++ b/ash/system/drive/tray_drive.cc
@@ -508,8 +508,5 @@ void TrayDrive::HideIfNoOperations() {
detailed_->Update(&empty_list);
}
-void TrayDrive::OnDriveOfflineEnabled() {
-}
-
} // namespace internal
} // namespace ash
diff --git a/ash/system/drive/tray_drive.h b/ash/system/drive/tray_drive.h
index 6f5f626..6550fde 100644
--- a/ash/system/drive/tray_drive.h
+++ b/ash/system/drive/tray_drive.h
@@ -41,7 +41,6 @@ class TrayDrive : public TrayImageItem,
// Overridden from DriveObserver.
virtual void OnDriveJobUpdated(const DriveOperationStatus& status) OVERRIDE;
- virtual void OnDriveOfflineEnabled() OVERRIDE;
// Delayed hiding of the tray item after encountering an empty operation list.
void HideIfNoOperations();
diff --git a/ash/system/tray/system_tray.cc b/ash/system/tray/system_tray.cc
index 151beae..045526c 100644
--- a/ash/system/tray/system_tray.cc
+++ b/ash/system/tray/system_tray.cc
@@ -49,7 +49,6 @@
#if defined(OS_CHROMEOS)
#include "ash/system/chromeos/audio/tray_audio.h"
#include "ash/system/chromeos/brightness/tray_brightness.h"
-#include "ash/system/chromeos/drive/tray_drive_notice.h"
#include "ash/system/chromeos/enterprise/tray_enterprise.h"
#include "ash/system/chromeos/managed/tray_locally_managed_user.h"
#include "ash/system/chromeos/network/tray_network.h"
@@ -182,7 +181,6 @@ void SystemTray::CreateItems(SystemTrayDelegate* delegate) {
#if defined(OS_CHROMEOS)
AddTrayItem(new internal::TrayEnterprise(this));
- AddTrayItem(new internal::TrayDriveNotice(this));
AddTrayItem(new internal::TrayLocallyManagedUser(this));
AddTrayItem(new internal::TrayIME(this));
AddTrayItem(tray_accessibility_);
diff --git a/ash/system/tray/system_tray_notifier.cc b/ash/system/tray/system_tray_notifier.cc
index f3bc793..e2035ad 100644
--- a/ash/system/tray/system_tray_notifier.cc
+++ b/ash/system/tray/system_tray_notifier.cc
@@ -220,12 +220,6 @@ void SystemTrayNotifier::NotifyDriveJobUpdated(
OnDriveJobUpdated(status));
}
-void SystemTrayNotifier::NotifyDriveOfflineEnabled() {
- FOR_EACH_OBSERVER(DriveObserver,
- drive_observers_,
- OnDriveOfflineEnabled());
-}
-
void SystemTrayNotifier::NotifyRefreshIME(bool show_message) {
FOR_EACH_OBSERVER(IMEObserver,
ime_observers_,
diff --git a/ash/system/tray/system_tray_notifier.h b/ash/system/tray/system_tray_notifier.h
index 3b028bb..3d7fb0e 100644
--- a/ash/system/tray/system_tray_notifier.h
+++ b/ash/system/tray/system_tray_notifier.h
@@ -101,7 +101,6 @@ public:
void NotifyDateFormatChanged();
void NotifySystemClockTimeUpdated();
void NotifyDriveJobUpdated(const DriveOperationStatus& status);
- void NotifyDriveOfflineEnabled();
void NotifyRefreshIME(bool show_message);
void NotifyShowLoginButtonChanged(bool show_login_button);
void NotifyLocaleChanged(LocaleObserver::Delegate* delegate,
diff --git a/chrome/browser/chromeos/first_run/drive_first_run_controller.cc b/chrome/browser/chromeos/first_run/drive_first_run_controller.cc
index 9526948..0f477c5 100644
--- a/chrome/browser/chromeos/first_run/drive_first_run_controller.cc
+++ b/chrome/browser/chromeos/first_run/drive_first_run_controller.cc
@@ -4,8 +4,6 @@
#include "chrome/browser/chromeos/first_run/drive_first_run_controller.h"
-#include "ash/shell.h"
-#include "ash/system/tray/system_tray_notifier.h"
#include "base/callback.h"
#include "base/memory/weak_ptr.h"
#include "base/message_loop/message_loop.h"
@@ -378,8 +376,8 @@ void DriveFirstRunController::CleanUp() {
void DriveFirstRunController::OnOfflineInit(bool success) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
if (success) {
- ash::Shell::GetInstance()->system_tray_notifier()
- ->NotifyDriveOfflineEnabled();
+ // TODO(tengs): Show non-toast notification that offline files will now
+ // be synced.
}
FOR_EACH_OBSERVER(Observer, observer_list_, OnCompletion(success));
CleanUp();