diff options
author | kinaba@chromium.org <kinaba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-21 00:15:33 +0000 |
---|---|---|
committer | kinaba@chromium.org <kinaba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-21 00:15:33 +0000 |
commit | 20c0bdb676b47c6d3e2c60acccfcfbcf773b560b (patch) | |
tree | ee12eeffeb25319a6e213b1e05fb3fe8c513ac52 /chrome | |
parent | 31626465fbf8023e5f2688bb6527b84304c7139f (diff) | |
download | chromium_src-20c0bdb676b47c6d3e2c60acccfcfbcf773b560b.zip chromium_src-20c0bdb676b47c6d3e2c60acccfcfbcf773b560b.tar.gz chromium_src-20c0bdb676b47c6d3e2c60acccfcfbcf773b560b.tar.bz2 |
Revert 127839 - cros: Show system notification for GData upload/download.
BUG=chromium-os:27875
TEST=unit_tests --gtest_filter='*FileBrowser*'
TEST=manual test uploading/downloading in GData
Review URL: https://chromiumcodereview.appspot.com/9747001
TBR=kinaba@chromium.org
Review URL: https://chromiumcodereview.appspot.com/9766012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@127846 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/app/generated_resources.grd | 17 | ||||
-rw-r--r-- | chrome/app/theme/notification_gdata.png | bin | 407 -> 0 bytes | |||
-rw-r--r-- | chrome/app/theme/theme_resources.grd | 1 | ||||
-rw-r--r-- | chrome/browser/chromeos/extensions/file_browser_event_router.cc | 37 | ||||
-rw-r--r-- | chrome/browser/chromeos/extensions/file_browser_event_router.h | 8 | ||||
-rw-r--r-- | chrome/browser/chromeos/extensions/file_browser_notifications.cc | 79 | ||||
-rw-r--r-- | chrome/browser/chromeos/extensions/file_browser_notifications.h | 8 | ||||
-rw-r--r-- | chrome/browser/chromeos/extensions/file_browser_notifications_unittest.cc | 69 | ||||
-rw-r--r-- | chrome/browser/chromeos/gdata/gdata_operation_registry.cc | 30 | ||||
-rw-r--r-- | chrome/browser/chromeos/gdata/gdata_operation_registry.h | 2 |
10 files changed, 20 insertions, 231 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 564f813..27fb858 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -14169,23 +14169,6 @@ Battery full Aw, Snap! There've been some errors while formatting... </message> - <!-- ChromeOS GData synchronization notifications --> - <message name="IDS_CHROMEOS_GDATA_SYNC_TITLE" desc="Title text of notification message which is shown when gdata sync is on progress."> - Syncing - </message> - <message name="IDS_CHROMEOS_GDATA_SYNC_FINISHED_FAILURE_TITLE" desc="Title text of notification message which is shown when there are some errors while gdata sync."> - Could not sync - </message> - <message name="IDS_CHROMEOS_GDATA_SYNC_PROGRESS_MESSAGE" desc="Text of notification message which is shown when gdata file sync is on progress."> - Syncing <ph name="COUNT">$1<ex>3</ex></ph> files... - </message> - <message name="IDS_CHROMEOS_GDATA_SYNC_FINISHED_SUCCESS_MESSAGE" desc="Text of notification message which is shown when gdata sync finishes without any errors."> - Sync complete. - </message> - <message name="IDS_CHROMEOS_GDATA_SYNC_FINISHED_FAILURE_MESSAGE" desc="Text of notification message which is shown when there are some errors while gdata sync."> - Unable to connect. - </message> - <!-- Network state strings for ChromeOS --> <message name="IDS_CHROMEOS_NETWORK_STATE_UNKNOWN" desc="Network state in about:network: UNKNOWN"> Unknown diff --git a/chrome/app/theme/notification_gdata.png b/chrome/app/theme/notification_gdata.png Binary files differdeleted file mode 100644 index 7eafb50..0000000 --- a/chrome/app/theme/notification_gdata.png +++ /dev/null diff --git a/chrome/app/theme/theme_resources.grd b/chrome/app/theme/theme_resources.grd index 741d754..ac029d2 100644 --- a/chrome/app/theme/theme_resources.grd +++ b/chrome/app/theme/theme_resources.grd @@ -464,7 +464,6 @@ <include name="IDR_NOTIFICATION_3G" file="notification_3g.png" type="BINDATA" /> <include name="IDR_NOTIFICATION_BARS_EMPTY" file="notification_bars_empty.png" type="BINDATA" /> <include name="IDR_NOTIFICATION_BARS_CRITICAL" file="notification_bars_critical.png" type="BINDATA" /> - <include name="IDR_NOTIFICATION_GDATA" file="notification_gdata.png" type="BINDATA" /> <include name="IDR_NOTIFICATION_LOCALE_CHANGE" file="notification_locale_change.png" type="BINDATA" /> <include name="IDR_NOTIFICATION_LOW_BATTERY" file="notification_battery_low.png" type="BINDATA" /> <include name="IDR_NOTIFICATION_MENU" file="notification_menu.png" type="BINDATA" /> diff --git a/chrome/browser/chromeos/extensions/file_browser_event_router.cc b/chrome/browser/chromeos/extensions/file_browser_event_router.cc index ec1014b..5725cd3 100644 --- a/chrome/browser/chromeos/extensions/file_browser_event_router.cc +++ b/chrome/browser/chromeos/extensions/file_browser_event_router.cc @@ -82,8 +82,7 @@ FileBrowserEventRouter::FileBrowserEventRouter( Profile* profile) : delegate_(new FileBrowserEventRouter::FileWatcherDelegate(this)), notifications_(new FileBrowserNotifications(profile)), - profile_(profile), - current_gdata_operation_failed_(false) { + profile_(profile) { } FileBrowserEventRouter::~FileBrowserEventRouter() { @@ -227,12 +226,6 @@ void FileBrowserEventRouter::MountCompleted( void FileBrowserEventRouter::OnProgressUpdate( const std::vector<gdata::GDataOperationRegistry::ProgressStatus>& list) { - HandleProgressUpdateForExtensionAPI(list); - HandleProgressUpdateForSystemNotification(list); -} - -void FileBrowserEventRouter::HandleProgressUpdateForExtensionAPI( - const std::vector<gdata::GDataOperationRegistry::ProgressStatus>& list) { scoped_ptr<ListValue> event_list( file_manager_util::ProgressStatusVectorToListValue( profile_, @@ -249,34 +242,6 @@ void FileBrowserEventRouter::HandleProgressUpdateForExtensionAPI( NULL, GURL()); } -void FileBrowserEventRouter::HandleProgressUpdateForSystemNotification( - const std::vector<gdata::GDataOperationRegistry::ProgressStatus>& list) { - int active_operation_count = 0; - for (std::vector< - gdata::GDataOperationRegistry::ProgressStatus>::const_iterator iter = - list.begin(); - iter != list.end(); ++iter) { - switch (iter->transfer_state) { - case gdata::GDataOperationRegistry::OPERATION_FAILED: - current_gdata_operation_failed_ = true; - break; - case gdata::GDataOperationRegistry::OPERATION_COMPLETED: - break; - default: - active_operation_count += 1; - break; - } - } - - if (active_operation_count == 0) { - notifications_->ManageNotificationOnGDataSyncFinish( - !current_gdata_operation_failed_); - current_gdata_operation_failed_ = false; - } else { - notifications_->ManageNotificationOnGDataSyncProgress( - active_operation_count); - } -} void FileBrowserEventRouter::HandleFileWatchNotification( const FilePath& local_path, bool got_error) { diff --git a/chrome/browser/chromeos/extensions/file_browser_event_router.h b/chrome/browser/chromeos/extensions/file_browser_event_router.h index 4ccdc8c..8b606f0 100644 --- a/chrome/browser/chromeos/extensions/file_browser_event_router.h +++ b/chrome/browser/chromeos/extensions/file_browser_event_router.h @@ -150,20 +150,12 @@ class FileBrowserEventRouter const std::string& device_path, bool small); - // Process GData operation list updates. - void HandleProgressUpdateForExtensionAPI( - const std::vector<gdata::GDataOperationRegistry::ProgressStatus>& list); - void HandleProgressUpdateForSystemNotification( - const std::vector<gdata::GDataOperationRegistry::ProgressStatus>& list); - scoped_refptr<FileWatcherDelegate> delegate_; WatcherMap file_watchers_; scoped_ptr<FileBrowserNotifications> notifications_; Profile* profile_; base::Lock lock_; - bool current_gdata_operation_failed_; - DISALLOW_COPY_AND_ASSIGN(FileBrowserEventRouter); }; diff --git a/chrome/browser/chromeos/extensions/file_browser_notifications.cc b/chrome/browser/chromeos/extensions/file_browser_notifications.cc index 9cacf66..38ea6ad 100644 --- a/chrome/browser/chromeos/extensions/file_browser_notifications.cc +++ b/chrome/browser/chromeos/extensions/file_browser_notifications.cc @@ -117,26 +117,6 @@ void FileBrowserNotifications::ShowNotification(NotificationType type, l10n_util::GetStringUTF16(GetMessageId(type))); } -void FileBrowserNotifications::ManageNotificationOnGDataSyncProgress( - int count) { - HideNotification(GDATA_SYNC_SUCCESS, ""); - HideNotification(GDATA_SYNC_FAIL, ""); - ShowNotificationWithMessage(GDATA_SYNC, "", - l10n_util::GetStringFUTF16Int(GetMessageId(GDATA_SYNC), count)); -} - -void FileBrowserNotifications::ManageNotificationOnGDataSyncFinish( - bool success) { - HideNotification(GDATA_SYNC, ""); - if (success) { - HideNotification(FileBrowserNotifications::GDATA_SYNC_FAIL, ""); - ShowNotification(FileBrowserNotifications::GDATA_SYNC_SUCCESS, ""); - } else { - HideNotification(FileBrowserNotifications::GDATA_SYNC_SUCCESS, ""); - ShowNotification(FileBrowserNotifications::GDATA_SYNC_FAIL, ""); - } -} - void FileBrowserNotifications::ShowNotificationWithMessage( NotificationType type, const std::string& path, const string16& message) { std::string notification_id; @@ -259,15 +239,6 @@ void FileBrowserNotifications::CreateNotificationId(NotificationType type, case(FORMAT_START): *id = "FS"; break; - case(GDATA_SYNC): - *id = "GD"; - break; - case(GDATA_SYNC_SUCCESS): - *id = "GS"; - break; - case(GDATA_SYNC_FAIL): - *id = "GF"; - break; default: *id = "FF"; } @@ -282,44 +253,20 @@ void FileBrowserNotifications::CreateNotificationId(NotificationType type, } int FileBrowserNotifications::GetIconId(NotificationType type) { - switch (type) { - case(DEVICE): - case(FORMAT_SUCCESS): - case(FORMAT_START): - return IDR_PAGEINFO_INFO; - case(GDATA_SYNC): - case(GDATA_SYNC_SUCCESS): - case(GDATA_SYNC_FAIL): - return IDR_NOTIFICATION_GDATA; - case(DEVICE_FAIL): - case(FORMAT_START_FAIL): - case(FORMAT_FAIL): - return IDR_PAGEINFO_WARNING_MAJOR; - default: - NOTREACHED(); - return 0; + if (type == DEVICE || type == FORMAT_SUCCESS || type == FORMAT_START) { + return IDR_PAGEINFO_INFO; + } else { + return IDR_PAGEINFO_WARNING_MAJOR; } } int FileBrowserNotifications::GetTitleId(NotificationType type) { - switch (type) { - case(DEVICE): - case(DEVICE_FAIL): - return IDS_REMOVABLE_DEVICE_DETECTION_TITLE; - case(FORMAT_START): - return IDS_FORMATTING_OF_DEVICE_PENDING_TITLE; - case(FORMAT_START_FAIL): - case(FORMAT_SUCCESS): - case(FORMAT_FAIL): - return IDS_FORMATTING_OF_DEVICE_FINISHED_TITLE; - case(GDATA_SYNC): - case(GDATA_SYNC_SUCCESS): - return IDS_CHROMEOS_GDATA_SYNC_TITLE; - case(GDATA_SYNC_FAIL): - return IDS_CHROMEOS_GDATA_SYNC_FINISHED_FAILURE_TITLE; - default: - NOTREACHED(); - return 0; + if (type == DEVICE || type == DEVICE_FAIL) { + return IDS_REMOVABLE_DEVICE_DETECTION_TITLE; + } else if (type == FORMAT_START) { + return IDS_FORMATTING_OF_DEVICE_PENDING_TITLE; + } else { + return IDS_FORMATTING_OF_DEVICE_FINISHED_TITLE; } } @@ -337,12 +284,6 @@ int FileBrowserNotifications::GetMessageId(NotificationType type) { return IDS_FORMATTING_OF_DEVICE_PENDING_MESSAGE; case(FORMAT_START_FAIL): return IDS_FORMATTING_STARTED_FAILURE_MESSAGE; - case(GDATA_SYNC): - return IDS_CHROMEOS_GDATA_SYNC_PROGRESS_MESSAGE; - case(GDATA_SYNC_SUCCESS): - return IDS_CHROMEOS_GDATA_SYNC_FINISHED_SUCCESS_MESSAGE; - case(GDATA_SYNC_FAIL): - return IDS_CHROMEOS_GDATA_SYNC_FINISHED_FAILURE_MESSAGE; default: NOTREACHED(); return 0; diff --git a/chrome/browser/chromeos/extensions/file_browser_notifications.h b/chrome/browser/chromeos/extensions/file_browser_notifications.h index 2522f4f..96d943e 100644 --- a/chrome/browser/chromeos/extensions/file_browser_notifications.h +++ b/chrome/browser/chromeos/extensions/file_browser_notifications.h @@ -25,10 +25,7 @@ class FileBrowserNotifications FORMAT_SUCCESS, FORMAT_FAIL, FORMAT_START, - FORMAT_START_FAIL, - GDATA_SYNC, - GDATA_SYNC_SUCCESS, - GDATA_SYNC_FAIL, + FORMAT_START_FAIL }; typedef std::map<std::string, linked_ptr<chromeos::SystemNotification> > @@ -46,9 +43,6 @@ class FileBrowserNotifications bool success, bool is_unsupported); - void ManageNotificationOnGDataSyncProgress(int count); - void ManageNotificationOnGDataSyncFinish(bool success); - void ShowNotification(NotificationType type, const std::string& path); void ShowNotificationDelayed(NotificationType type, const std::string& path, diff --git a/chrome/browser/chromeos/extensions/file_browser_notifications_unittest.cc b/chrome/browser/chromeos/extensions/file_browser_notifications_unittest.cc index dfb88a9..cbfce34 100644 --- a/chrome/browser/chromeos/extensions/file_browser_notifications_unittest.cc +++ b/chrome/browser/chromeos/extensions/file_browser_notifications_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -16,7 +16,6 @@ using ::testing::_; using ::testing::InSequence; using ::testing::Return; using ::testing::StrEq; -using ::testing::AnyNumber; namespace chromeos { @@ -218,70 +217,4 @@ TEST(FileBrowserMountNotificationsTest, MulitpleFail) { device_label, false, false, false); } -TEST(FileBrowserGDataNotificationsTest, GDataSyncSuccess) { - MockFileBrowserNotificationsOnMount* mocked_notifications = - new MockFileBrowserNotificationsOnMount(NULL); - scoped_ptr<FileBrowserNotifications> notifications(mocked_notifications); - - EXPECT_CALL(*mocked_notifications, HideNotification( - FileBrowserNotifications::GDATA_SYNC, _)).Times(AnyNumber()); - EXPECT_CALL(*mocked_notifications, HideNotification( - FileBrowserNotifications::GDATA_SYNC_SUCCESS, _)).Times(AnyNumber()); - EXPECT_CALL(*mocked_notifications, HideNotification( - FileBrowserNotifications::GDATA_SYNC_FAIL, _)).Times(AnyNumber()); - { - InSequence s; - EXPECT_CALL(*mocked_notifications, ShowNotificationWithMessage( - FileBrowserNotifications::GDATA_SYNC, _, - String16Equals(IDS_CHROMEOS_GDATA_SYNC_PROGRESS_MESSAGE, "2"))); - EXPECT_CALL(*mocked_notifications, ShowNotificationWithMessage( - FileBrowserNotifications::GDATA_SYNC, _, - String16Equals(IDS_CHROMEOS_GDATA_SYNC_PROGRESS_MESSAGE, "1"))); - EXPECT_CALL(*mocked_notifications, ShowNotificationWithMessage( - FileBrowserNotifications::GDATA_SYNC_SUCCESS, _, - l10n_util::GetStringUTF16( - IDS_CHROMEOS_GDATA_SYNC_FINISHED_SUCCESS_MESSAGE))); - } - - notifications->ManageNotificationOnGDataSyncProgress(2); - notifications->ManageNotificationOnGDataSyncProgress(1); - notifications->ManageNotificationOnGDataSyncFinish(true); -}; - - -TEST(FileBrowserGDataNotificationsTest, GDataSyncFailAndSuccess) { - MockFileBrowserNotificationsOnMount* mocked_notifications = - new MockFileBrowserNotificationsOnMount(NULL); - scoped_ptr<FileBrowserNotifications> notifications(mocked_notifications); - - EXPECT_CALL(*mocked_notifications, HideNotification( - FileBrowserNotifications::GDATA_SYNC, _)).Times(AnyNumber()); - EXPECT_CALL(*mocked_notifications, HideNotification( - FileBrowserNotifications::GDATA_SYNC_SUCCESS, _)).Times(AnyNumber()); - EXPECT_CALL(*mocked_notifications, HideNotification( - FileBrowserNotifications::GDATA_SYNC_FAIL, _)).Times(AnyNumber()); - { - InSequence s; - EXPECT_CALL(*mocked_notifications, ShowNotificationWithMessage( - FileBrowserNotifications::GDATA_SYNC, _, - String16Equals(IDS_CHROMEOS_GDATA_SYNC_PROGRESS_MESSAGE, "5"))); - EXPECT_CALL(*mocked_notifications, ShowNotificationWithMessage( - FileBrowserNotifications::GDATA_SYNC_FAIL, _, - l10n_util::GetStringUTF16( - IDS_CHROMEOS_GDATA_SYNC_FINISHED_FAILURE_MESSAGE))); - EXPECT_CALL(*mocked_notifications, ShowNotificationWithMessage( - FileBrowserNotifications::GDATA_SYNC, _, - String16Equals(IDS_CHROMEOS_GDATA_SYNC_PROGRESS_MESSAGE, "2"))); - EXPECT_CALL(*mocked_notifications, ShowNotificationWithMessage( - FileBrowserNotifications::GDATA_SYNC_SUCCESS, _, - l10n_util::GetStringUTF16( - IDS_CHROMEOS_GDATA_SYNC_FINISHED_SUCCESS_MESSAGE))); - } - - notifications->ManageNotificationOnGDataSyncProgress(5); - notifications->ManageNotificationOnGDataSyncFinish(false); - notifications->ManageNotificationOnGDataSyncProgress(2); - notifications->ManageNotificationOnGDataSyncFinish(true); -}; - } // namespace chromeos. diff --git a/chrome/browser/chromeos/gdata/gdata_operation_registry.cc b/chrome/browser/chromeos/gdata/gdata_operation_registry.cc index dc4f393..c993a38 100644 --- a/chrome/browser/chromeos/gdata/gdata_operation_registry.cc +++ b/chrome/browser/chromeos/gdata/gdata_operation_registry.cc @@ -159,10 +159,8 @@ void GDataOperationRegistry::OnOperationStart( *id = in_flight_operations_.Add(operation); DVLOG(1) << "GDataOperation[" << *id << "] started."; - if (IsFileTransferOperation(operation)) { - FOR_EACH_OBSERVER(Observer, observer_list_, - OnProgressUpdate(GetProgressStatusList())); - } + FOR_EACH_OBSERVER(Observer, observer_list_, + OnProgressUpdate(GetProgressStatusList())); } void GDataOperationRegistry::OnOperationProgress(OperationID id) { @@ -173,32 +171,19 @@ void GDataOperationRegistry::OnOperationProgress(OperationID id) { DVLOG(1) << "GDataOperation[" << id << "] " << operation->progress_status().ToString(); - if (IsFileTransferOperation(operation)) { - FOR_EACH_OBSERVER(Observer, observer_list_, - OnProgressUpdate(GetProgressStatusList())); - } + FOR_EACH_OBSERVER(Observer, observer_list_, + OnProgressUpdate(GetProgressStatusList())); } void GDataOperationRegistry::OnOperationFinish(OperationID id) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - Operation* operation = in_flight_operations_.Lookup(id); - DCHECK(operation); - DVLOG(1) << "GDataOperation[" << id << "] finished."; - if (IsFileTransferOperation(operation)) { - FOR_EACH_OBSERVER(Observer, observer_list_, - OnProgressUpdate(GetProgressStatusList())); - } + FOR_EACH_OBSERVER(Observer, observer_list_, + OnProgressUpdate(GetProgressStatusList())); in_flight_operations_.Remove(id); } -bool GDataOperationRegistry::IsFileTransferOperation( - const Operation* operation) const { - OperationType type = operation->progress_status().operation_type; - return type == OPERATION_UPLOAD || type == OPERATION_DOWNLOAD; -} - std::vector<GDataOperationRegistry::ProgressStatus> GDataOperationRegistry::GetProgressStatusList() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -208,8 +193,7 @@ GDataOperationRegistry::GetProgressStatusList() { !iter.IsAtEnd(); iter.Advance()) { const Operation* operation = iter.GetCurrentValue(); - if (IsFileTransferOperation(operation)) - status_list.push_back(operation->progress_status()); + status_list.push_back(operation->progress_status()); } return status_list; } diff --git a/chrome/browser/chromeos/gdata/gdata_operation_registry.h b/chrome/browser/chromeos/gdata/gdata_operation_registry.h index c91424a..ecce955 100644 --- a/chrome/browser/chromeos/gdata/gdata_operation_registry.h +++ b/chrome/browser/chromeos/gdata/gdata_operation_registry.h @@ -132,8 +132,6 @@ class GDataOperationRegistry { void OnOperationProgress(OperationID operation); void OnOperationFinish(OperationID operation); - bool IsFileTransferOperation(const Operation* operation) const; - typedef IDMap<Operation, IDMapOwnPointer> OperationIDMap; OperationIDMap in_flight_operations_; ObserverList<Observer> observer_list_; |