summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorhirono@chromium.org <hirono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-22 05:26:42 +0000
committerhirono@chromium.org <hirono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-22 05:26:42 +0000
commit4a770f511fbf4848ed2a7a074b0616f855007523 (patch)
tree036d3442d9668e427963039bd51209f999b1440c /ui
parentdfa1c2311ecd79a8d91592996c808a3f6cd0b7ef (diff)
downloadchromium_src-4a770f511fbf4848ed2a7a074b0616f855007523.zip
chromium_src-4a770f511fbf4848ed2a7a074b0616f855007523.tar.gz
chromium_src-4a770f511fbf4848ed2a7a074b0616f855007523.tar.bz2
Merge 290456 "Files.app: Ignore device notifications during star..."
> Files.app: Ignore device notifications during start up. > > BUG=396258,360946 > > Review URL: https://codereview.chromium.org/477903002 TBR=hirono@chromium.org Review URL: https://codereview.chromium.org/493303003 git-svn-id: svn://svn.chromium.org/chrome/branches/2125/src@291332 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r--ui/file_manager/file_manager/background/js/device_handler.js36
1 files changed, 29 insertions, 7 deletions
diff --git a/ui/file_manager/file_manager/background/js/device_handler.js b/ui/file_manager/file_manager/background/js/device_handler.js
index f72525e..c24ce08 100644
--- a/ui/file_manager/file_manager/background/js/device_handler.js
+++ b/ui/file_manager/file_manager/background/js/device_handler.js
@@ -27,12 +27,22 @@ function DeviceHandler() {
*/
this.navigationVolumes_ = {};
+ /**
+ * Whether the device is just after starting up or not.
+ *
+ * @type {boolean}
+ * @private
+ */
+ this.isStartup_ = false;
+
chrome.fileBrowserPrivate.onDeviceChanged.addListener(
this.onDeviceChanged_.bind(this));
chrome.fileBrowserPrivate.onMountCompleted.addListener(
this.onMountCompleted_.bind(this));
chrome.notifications.onButtonClicked.addListener(
this.onNotificationButtonClicked_.bind(this));
+ chrome.runtime.onStartup.addListener(
+ this.onStartup_.bind(this));
}
DeviceHandler.prototype = {
@@ -247,7 +257,8 @@ DeviceHandler.Notification.prototype.clearTimeout_ = function() {
DeviceHandler.prototype.onDeviceChanged_ = function(event) {
switch (event.type) {
case 'added':
- DeviceHandler.Notification.DEVICE.showLater(event.devicePath);
+ if (!this.isStartup_)
+ DeviceHandler.Notification.DEVICE.showLater(event.devicePath);
this.mountStatus_[event.devicePath] = DeviceHandler.MountStatus.NO_RESULT;
break;
case 'disabled':
@@ -265,8 +276,10 @@ DeviceHandler.prototype.onDeviceChanged_ = function(event) {
delete this.mountStatus_[event.devicePath];
break;
case 'hard_unplugged':
- DeviceHandler.Notification.DEVICE_HARD_UNPLUGGED.show(
- event.devicePath);
+ if (!this.isStartup_) {
+ DeviceHandler.Notification.DEVICE_HARD_UNPLUGGED.show(
+ event.devicePath);
+ }
break;
case 'format_start':
DeviceHandler.Notification.FORMAT_START.show(event.devicePath);
@@ -329,10 +342,12 @@ DeviceHandler.prototype.onMountCompleted_ = function(event) {
event.volumeMetadata.volumeId;
}
} else {
- this.navigationVolumes_[event.volumeMetadata.devicePath] =
- event.volumeMetadata.volumeId;
- DeviceHandler.Notification.DEVICE_NAVIGATION.show(
- event.volumeMetadata.devicePath);
+ if (!this.isStartup_) {
+ this.navigationVolumes_[event.volumeMetadata.devicePath] =
+ event.volumeMetadata.volumeId;
+ DeviceHandler.Notification.DEVICE_NAVIGATION.show(
+ event.volumeMetadata.devicePath);
+ }
}
}
@@ -433,3 +448,10 @@ DeviceHandler.prototype.onNotificationButtonClicked_ = function(id) {
this.dispatchEvent(event);
}
};
+
+DeviceHandler.prototype.onStartup_ = function() {
+ this.isStartup_ = true;
+ setTimeout(function() {
+ this.isStartup_ = false;
+ }.bind(this), 5000);
+};