Revert of Add button to add new FSP services to Files app. (patchset #8 id:140001 of https://codereview.chromium.org/1056433003/)
Reason for revert:
Broke the build:
http://build.chromium.org/p/chromium.fyi/builders/Closure%20Compilation%20Linux/builds/18940
## /mnt/data/b/build/slave/Closure_Compilation_Linux/build/src/ui/file_manager/file_manager/foreground/js/navigation_list_model.js:33: ERROR - NavigationModelShortcutItem cannot extend this type; structs can only extend structs
## function NavigationModelShortcutItem(label, entry) {
Original issue's description:
> Add button to add new FSP services to Files app.
>
> This CL adds a FSP suggest dialog which can be shown by clicking the button at
> the end of the left nav.
>
> TEST=Tested manually by clicking on the new button in the left nav.
> BUG=471722
TBR=hirono@chromium.org,mtomasz@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=471722
Review URL: https://codereview.chromium.org/1058873004
Cr-Commit-Position: refs/heads/master@{#323556}
diff --git a/chrome/app/chromeos_strings.grdp b/chrome/app/chromeos_strings.grdp
index 1c179e6..8a58738 100644
--- a/chrome/app/chromeos_strings.grdp
+++ b/chrome/app/chromeos_strings.grdp
@@ -247,9 +247,6 @@
<message name="IDS_FILE_BROWSER_CLOSE_VOLUME_BUTTON_LABEL" desc="Title of the action for closing either an archive volume or a volume provided by an extension.">
Close
</message>
- <message name="IDS_FILE_BROWSER_ADD_NEW_SERVICES_BUTTON_LABEL" desc="Title of the button in the left nav to add new services (file systems) to Files app.">
- Add new services
- </message>
<message name="IDS_FILE_BROWSER_ACTION_VIEW" desc="Title of the action to view (no edit) a file.">
View
</message>
@@ -684,9 +681,6 @@
<message name="IDS_FILE_BROWSER_SUGGEST_DIALOG_TITLE" desc="Title of the suggest app dialog, which shows the list of the apps which supports the selected file.">
Select an app to open this file
</message>
- <message name="IDS_FILE_BROWSER_SUGGEST_DIALOG_FOR_PROVIDERS_TITLE" desc="Title of the suggest app dialog, which shows the list of the apps that can be added to the left nav of Files app.">
- Available services
- </message>
<message name="IDS_FILE_BROWSER_SUGGEST_DIALOG_LINK_TO_WEBSTORE" desc="Text of the link to the app list on Chrome Webstore, which shows the more apps than in the suggest app dialog.">
See more...
</message>
diff --git a/chrome/browser/chromeos/extensions/file_manager/private_api_strings.cc b/chrome/browser/chromeos/extensions/file_manager/private_api_strings.cc
index 6606bc72..9278fc50 100644
--- a/chrome/browser/chromeos/extensions/file_manager/private_api_strings.cc
+++ b/chrome/browser/chromeos/extensions/file_manager/private_api_strings.cc
@@ -263,8 +263,6 @@
IDS_FILE_BROWSER_CHANGE_DEFAULT_MENU_ITEM);
SET_STRING("CLOSE_VOLUME_BUTTON_LABEL",
IDS_FILE_BROWSER_CLOSE_VOLUME_BUTTON_LABEL);
- SET_STRING("ADD_NEW_SERVICES_BUTTON_LABEL",
- IDS_FILE_BROWSER_ADD_NEW_SERVICES_BUTTON_LABEL);
SET_STRING("CLOUD_IMPORT_TITLE",
IDS_FILE_BROWSER_CLOUD_IMPORT_TITLE);
@@ -525,8 +523,6 @@
SET_STRING("SUGGEST_DIALOG_LINK_TO_WEBSTORE",
IDS_FILE_BROWSER_SUGGEST_DIALOG_LINK_TO_WEBSTORE);
SET_STRING("SUGGEST_DIALOG_TITLE", IDS_FILE_BROWSER_SUGGEST_DIALOG_TITLE);
- SET_STRING("SUGGEST_DIALOG_FOR_PROVIDERS_TITLE",
- IDS_FILE_BROWSER_SUGGEST_DIALOG_FOR_PROVIDERS_TITLE);
SET_STRING("SYNC_DELETE_WITHOUT_PERMISSION_ERROR",
IDS_FILE_BROWSER_SYNC_DELETE_WITHOUT_PERMISSION_ERROR);
SET_STRING("SYNC_FILE_NAME", IDS_FILE_BROWSER_SYNC_FILE_NAME);
diff --git a/ui/file_manager/file_manager/foreground/css/file_manager.css b/ui/file_manager/file_manager/foreground/css/file_manager.css
index 6b76816..41b3ef5 100644
--- a/ui/file_manager/file_manager/foreground/css/file_manager.css
+++ b/ui/file_manager/file_manager/foreground/css/file_manager.css
@@ -193,7 +193,7 @@
width: 36px;
}
-#directory-tree .tree-row > .item-icon {
+#directory-tree .tree-row > .volume-icon {
flex: none;
height: 16px;
width: 16px;
diff --git a/ui/file_manager/file_manager/foreground/css/file_types.css b/ui/file_manager/file_manager/foreground/css/file_types.css
index 832173b..fb39d54 100644
--- a/ui/file_manager/file_manager/foreground/css/file_types.css
+++ b/ui/file_manager/file_manager/foreground/css/file_types.css
@@ -328,9 +328,3 @@
/* Apply the rgb(90, 90, 90) mask. */
-webkit-filter: contrast(0) brightness(0.7143);
}
-
-.tree-row [command-icon='add-new-services'] {
- background-image: -webkit-image-set(
- url(../images/volumes/add.png) 1x,
- url(../images/volumes/2x/add.png) 2x);
-}
diff --git a/ui/file_manager/file_manager/foreground/images/volumes/2x/add.png b/ui/file_manager/file_manager/foreground/images/volumes/2x/add.png
deleted file mode 100644
index 08e26c1..0000000
--- a/ui/file_manager/file_manager/foreground/images/volumes/2x/add.png
+++ /dev/null
Binary files differ
diff --git a/ui/file_manager/file_manager/foreground/images/volumes/add.png b/ui/file_manager/file_manager/foreground/images/volumes/add.png
deleted file mode 100644
index 9061c7d..0000000
--- a/ui/file_manager/file_manager/foreground/images/volumes/add.png
+++ /dev/null
Binary files differ
diff --git a/ui/file_manager/file_manager/foreground/js/cws_container_client.js b/ui/file_manager/file_manager/foreground/js/cws_container_client.js
index 650f3c1..d177630e 100644
--- a/ui/file_manager/file_manager/foreground/js/cws_container_client.js
+++ b/ui/file_manager/file_manager/foreground/js/cws_container_client.js
@@ -4,21 +4,26 @@
/**
* @param {WebView} webView Web View tag.
+ * @param {?string} ext File extension.
+ * @param {?string} mime File mime type.
+ * @param {?string} searchQuery Search query.
* @param {number} width Width of the CWS widget.
* @param {number} height Height of the CWS widget.
* @param {string} url Share Url for an entry.
* @param {string} target Target (scheme + host + port) of the widget.
- * @param {Object<string, *>} options Options to be sent to the dialog host.
* @constructor
* @extends {cr.EventTarget}
*/
-function CWSContainerClient(webView, width, height, url, target, options) {
+function CWSContainerClient(
+ webView, ext, mime, searchQuery, width, height, url, target) {
this.webView_ = webView;
+ this.ext_ = (ext && ext[0] == '.') ? ext.substr(1) : ext;
+ this.mime_ = mime;
+ this.searchQuery_ = searchQuery;
this.width_ = width;
this.height_ = height;
this.url_ = url;
this.target_ = target;
- this.options_ = options;
this.loaded_ = false;
this.loading_ = false;
@@ -185,10 +190,11 @@
v: 1
};
- if (this.options_) {
- Object.keys(this.options_).forEach(function(key) {
- message[key] = this.options_[key];
- }.bind(this));
+ if (this.searchQuery_) {
+ message['search_query'] = this.searchQuery_;
+ } else {
+ message['file_extension'] = this.ext_;
+ message['mime_type'] = this.mime_;
}
this.postMessage_(message);
diff --git a/ui/file_manager/file_manager/foreground/js/file_manager.js b/ui/file_manager/file_manager/foreground/js/file_manager.js
index c760fb2..2ccc3b9 100644
--- a/ui/file_manager/file_manager/foreground/js/file_manager.js
+++ b/ui/file_manager/file_manager/foreground/js/file_manager.js
@@ -946,10 +946,7 @@
assert(this.metadataModel_),
fakeEntriesVisible);
directoryTree.dataModel = new NavigationListModel(
- this.volumeManager_,
- this.folderShortcutsModel_,
- new NavigationModelCommandItem(
- util.queryDecoratedElement('#add-new-services', cr.ui.Command)));
+ this.volumeManager_, this.folderShortcutsModel_);
this.ui_.initDirectoryTree(directoryTree);
};
diff --git a/ui/file_manager/file_manager/foreground/js/file_manager_commands.js b/ui/file_manager/file_manager/foreground/js/file_manager_commands.js
index 85bf8a8f..0b8bdbe 100644
--- a/ui/file_manager/file_manager/foreground/js/file_manager_commands.js
+++ b/ui/file_manager/file_manager/foreground/js/file_manager_commands.js
@@ -1239,18 +1239,3 @@
},
canExecute: CommandUtil.canExecuteAlways
});
-
-/**
- * Shows a suggest dialog with new services to be added to the left nav.
- * @type {Command}
- */
-CommandHandler.COMMANDS_['add-new-services'] = /** @type {Command} */ ({
- /**
- * @param {!Event} event Command event.
- * @param {!FileManager} fileManager FileManager to use.
- */
- execute: function(event, fileManager) {
- fileManager.ui.suggestAppsDialog.showProviders(function() {});
- },
- canExecute: CommandUtil.canExecuteAlways
-});
diff --git a/ui/file_manager/file_manager/foreground/js/navigation_list_model.js b/ui/file_manager/file_manager/foreground/js/navigation_list_model.js
index 38f2671..5195f86 100644
--- a/ui/file_manager/file_manager/foreground/js/navigation_list_model.js
+++ b/ui/file_manager/file_manager/foreground/js/navigation_list_model.js
@@ -11,34 +11,45 @@
this.label_ = label;
}
-NavigationModelItem.Type = {
- SHORTCUT: 'shortcut',
- VOLUME: 'volume',
- COMMAND: 'command'
-};
-
NavigationModelItem.prototype = {
get label() { return this.label_; }
};
/**
+ * Check whether given two model items are same.
+ * @param {NavigationModelItem} item1 The first item to be compared.
+ * @param {NavigationModelItem} item2 The second item to be compared.
+ * @return {boolean} True if given two model items are same.
+ */
+NavigationModelItem.isSame = function(item1, item2) {
+ if (item1.isVolume != item2.isVolume)
+ return false;
+
+ if (item1.isVolume)
+ return item1.volumeInfo === item2.volumeInfo;
+ else
+ return util.isSameEntry(item1.entry, item2.entry);
+};
+
+/**
* Item of NavigationListModel for shortcuts.
*
* @param {string} label Label.
* @param {!DirectoryEntry} entry Entry. Cannot be null.
* @constructor
* @extends {NavigationModelItem}
- * @struct
*/
function NavigationModelShortcutItem(label, entry) {
NavigationModelItem.call(this, label);
this.entry_ = entry;
+ Object.freeze(this);
}
NavigationModelShortcutItem.prototype = {
__proto__: NavigationModelItem.prototype,
get entry() { return this.entry_; },
- get type() { return NavigationModelItem.Type.SHORTCUT; }
+ get isVolume() { return false; },
+ get isShortcut() { return true; }
};
/**
@@ -48,7 +59,6 @@
* @param {!VolumeInfo} volumeInfo Volume info for the volume. Cannot be null.
* @constructor
* @extends {NavigationModelItem}
- * @struct
*/
function NavigationModelVolumeItem(label, volumeInfo) {
NavigationModelItem.call(this, label);
@@ -57,49 +67,29 @@
// for determining executability of commands.
this.volumeInfo_.resolveDisplayRoot(
function() {}, function() {});
+ Object.freeze(this);
}
NavigationModelVolumeItem.prototype = {
__proto__: NavigationModelItem.prototype,
get volumeInfo() { return this.volumeInfo_; },
- get type() { return NavigationModelItem.Type.VOLUME; }
+ get isVolume() { return true; },
+ get isShortcut() { return false; }
};
/**
- * Item of NavigationListModel for commands.
- *
- * @param {cr.ui.Command} command
- * @constructor
- * @extends {NavigationModelItem}
- * @struct
- */
-function NavigationModelCommandItem(command) {
- NavigationModelItem.call(this, command.label);
- this.command_ = command;
-}
-
-NavigationModelCommandItem.prototype = {
- __proto__: NavigationModelItem.prototype,
- get command() { return this.command_; },
- get type() { return NavigationModelItem.Type.COMMAND; }
-};
-
-/**
- * A navigation list model. This model combines multiple models.
+ * A navigation list model. This model combines the 2 lists.
* @param {VolumeManagerWrapper} volumeManager VolumeManagerWrapper instance.
* @param {(cr.ui.ArrayDataModel|FolderShortcutsDataModel)} shortcutListModel
* The list of folder shortcut.
- * @param {NavigationModelCommandItem} commandModel, Command button at the
- * end of the list.
* @constructor
* @extends {cr.EventTarget}
*/
-function NavigationListModel(volumeManager, shortcutListModel, commandModel) {
+function NavigationListModel(volumeManager, shortcutListModel) {
cr.EventTarget.call(this);
this.volumeManager_ = volumeManager;
this.shortcutListModel_ = shortcutListModel;
- this.commandModel_ = commandModel;
var volumeInfoToModelItem = function(volumeInfo) {
return new NavigationModelVolumeItem(
@@ -252,12 +242,10 @@
* @return {NavigationModelItem} The item at the given index.
*/
NavigationListModel.prototype.item = function(index) {
- if (index < this.volumeList_.length)
+ var offset = this.volumeList_.length;
+ if (index < offset)
return this.volumeList_[index];
- if (index < this.volumeList_.length + this.shortcutList_.length)
- return this.shortcutList_[index - this.volumeList_.length];
- if (index === this.length_() - 1)
- return this.commandModel_;
+ return this.shortcutList_[index - offset];
};
/**
@@ -266,8 +254,7 @@
* @private
*/
NavigationListModel.prototype.length_ = function() {
- return this.volumeList_.length + this.shortcutList_.length +
- (this.commandModel_ ? 1 : 0);
+ return this.volumeList_.length + this.shortcutList_.length;
};
/**
@@ -290,6 +277,12 @@
* @param {NavigationModelItem} modelItem The entry which is not found.
*/
NavigationListModel.prototype.onItemNotFoundError = function(modelItem) {
- if (modelItem.type === NavigationModelItem.Type.SHORTCUT)
+ if (modelItem.isVolume) {
+ // TODO(mtomasz, yoshiki): Implement when needed.
+ return;
+ }
+ if (modelItem.isShortcut) {
+ // For shortcuts, lets the shortcut model handle this situation.
this.shortcutListModel_.onItemNotFoundError(modelItem.entry);
+ }
};
diff --git a/ui/file_manager/file_manager/foreground/js/ui/directory_tree.js b/ui/file_manager/file_manager/foreground/js/ui/directory_tree.js
index 3230707..a699aa5 100644
--- a/ui/file_manager/file_manager/foreground/js/ui/directory_tree.js
+++ b/ui/file_manager/file_manager/foreground/js/ui/directory_tree.js
@@ -347,7 +347,7 @@
// Sets up icons of the item.
var icon = item.querySelector('.icon');
- icon.classList.add('item-icon');
+ icon.classList.add('volume-icon');
var location = tree.volumeManager.getLocationInfo(item.entry);
if (location && location.rootType && location.isRootEntry) {
icon.setAttribute('volume-type-icon', location.rootType);
@@ -505,7 +505,7 @@
* @private
*/
VolumeItem.prototype.setupIcon_ = function(icon, volumeInfo) {
- icon.classList.add('item-icon');
+ icon.classList.add('volume-icon');
if (volumeInfo.volumeType === VolumeManagerCommon.VolumeType.PROVIDED) {
var backgroundImage = '-webkit-image-set(' +
'url(chrome://extension-icon/' + volumeInfo.extensionId +
@@ -689,7 +689,7 @@
item.innerHTML = TREE_ITEM_INNTER_HTML;
var icon = item.querySelector('.icon');
- icon.classList.add('item-icon');
+ icon.classList.add('volume-icon');
icon.setAttribute('volume-type-icon', VolumeManagerCommon.VolumeType.DRIVE);
if (tree.contextMenuForRootItems)
@@ -782,77 +782,6 @@
};
////////////////////////////////////////////////////////////////////////////////
-// CommandItem
-
-/**
- * A TreeItem which represents a command button.
- * Command items are displayed as top-level children of DirectoryTree.
- *
- * @param {NavigationModelCommandItem} modelItem
- * @param {DirectoryTree} tree Current tree, which contains this item.
- * @extends {cr.ui.TreeItem}
- * @constructor
- */
-function CommandItem(modelItem, tree) {
- var item = new cr.ui.TreeItem();
- item.__proto__ = CommandItem.prototype;
-
- item.parentTree_ = tree;
- item.modelItem_ = modelItem;
-
- item.innerHTML = TREE_ITEM_INNTER_HTML;
-
- var icon = item.querySelector('.icon');
- icon.classList.add('item-icon');
- icon.setAttribute('command-icon', modelItem.command.id);
-
- item.label = modelItem.label;
- return item;
-}
-
-CommandItem.prototype = {
- __proto__: cr.ui.TreeItem.prototype,
- get entry() {
- return null;
- },
- get modelItem() {
- return this.modelItem_;
- },
- get labelElement() {
- return this.firstElementChild.querySelector('.label');
- }
-};
-
-/**
- * @param {!DirectoryEntry|!FakeEntry} entry
- * @return {boolean} True if the parent item is found.
- */
-CommandItem.prototype.searchAndSelectByEntry = function(entry) {
- return false;
-};
-
-/**
- * @override
- */
-CommandItem.prototype.handleClick = function(e) {
- this.activate();
-};
-
-/**
- * @param {!DirectoryEntry} entry
- */
-CommandItem.prototype.selectByEntry = function(entry) {
-};
-
-/**
- * Executes the command.
- */
-CommandItem.prototype.activate = function() {
- this.modelItem_.command.execute();
-};
-
-
-////////////////////////////////////////////////////////////////////////////////
// DirectoryTree
/**
@@ -958,9 +887,8 @@
for (var i = 0; i < this.items.length;) {
var found = false;
for (var j = 0; j < this.dataModel.length; j++) {
- // Comparison by references, which is safe here, as model items are long
- // living.
- if (this.items[i].modelItem === this.dataModel.item(j)) {
+ if (NavigationModelItem.isSame(this.items[i].modelItem,
+ this.dataModel.item(j))) {
found = true;
break;
}
@@ -979,26 +907,21 @@
var itemIndex = 0;
while (modelIndex < this.dataModel.length) {
if (itemIndex < this.items.length &&
- this.items[itemIndex].modelItem === this.dataModel.item(modelIndex)) {
+ NavigationModelItem.isSame(this.items[itemIndex].modelItem,
+ this.dataModel.item(modelIndex))) {
if (recursive && this.items[itemIndex] instanceof VolumeItem)
this.items[itemIndex].updateSubDirectories(true);
} else {
var modelItem = this.dataModel.item(modelIndex);
- switch (modelItem.type) {
- case NavigationModelItem.Type.VOLUME:
- if (modelItem.volumeInfo.volumeType ===
- VolumeManagerCommon.VolumeType.DRIVE) {
- this.addAt(new DriveVolumeItem(modelItem, this), itemIndex);
- } else {
- this.addAt(new VolumeItem(modelItem, this), itemIndex);
- }
- break;
- case NavigationModelItem.Type.SHORTCUT:
- this.addAt(new ShortcutItem(modelItem, this), itemIndex);
- break;
- case NavigationModelItem.Type.COMMAND:
- this.addAt(new CommandItem(modelItem, this), itemIndex);
- break;
+ if (modelItem.isVolume) {
+ if (modelItem.volumeInfo.volumeType ===
+ VolumeManagerCommon.VolumeType.DRIVE) {
+ this.addAt(new DriveVolumeItem(modelItem, this), itemIndex);
+ } else {
+ this.addAt(new VolumeItem(modelItem, this), itemIndex);
+ }
+ } else {
+ this.addAt(new ShortcutItem(modelItem, this), itemIndex);
}
}
itemIndex++;
diff --git a/ui/file_manager/file_manager/foreground/js/ui/suggest_apps_dialog.js b/ui/file_manager/file_manager/foreground/js/ui/suggest_apps_dialog.js
index bd356a0..2c7c38c 100644
--- a/ui/file_manager/file_manager/foreground/js/ui/suggest_apps_dialog.js
+++ b/ui/file_manager/file_manager/foreground/js/ui/suggest_apps_dialog.js
@@ -21,13 +21,12 @@
var WEBVIEW_HEIGHT = 480;
/**
- * The URL of the widget showing suggested apps.
+ * The URL of the widget.
* @type {string}
* @const
*/
var CWS_WIDGET_URL =
'https://clients5.google.com/webstore/wall/cros-widget-container';
-
/**
* The origin of the widget.
* @type {string}
@@ -63,7 +62,6 @@
this.frame_.appendChild(this.buttons_);
this.webstoreButton_ = this.document_.createElement('div');
- this.webstoreButton_.hidden = true;
this.webstoreButton_.id = 'webstore-button';
this.webstoreButton_.innerHTML = str('SUGGEST_DIALOG_LINK_TO_WEBSTORE');
this.webstoreButton_.addEventListener(
@@ -74,11 +72,13 @@
this.webview_ = null;
this.accessToken_ = null;
- this.widgetUrl_ = state.overrideCwsContainerUrlForTest || CWS_WIDGET_URL;
- this.widgetOrigin_ = state.overrideCwsContainerOriginForTest ||
- CWS_WIDGET_ORIGIN;
+ this.widgetUrl_ =
+ state.overrideCwsContainerUrlForTest || CWS_WIDGET_URL;
+ this.widgetOrigin_ =
+ state.overrideCwsContainerOriginForTest || CWS_WIDGET_ORIGIN;
- this.options_ = null;
+ this.extension_ = null;
+ this.mime_ = null;
this.installingItemId_ = null;
this.state_ = SuggestAppsDialog.State.UNINITIALIZED;
@@ -176,7 +176,7 @@
/**
* Shows suggest-apps dialog by file extension and mime.
*
- * @param {string} extension Extension of the file with a trailing dot.
+ * @param {string} extension Extension of the file.
* @param {string} mime Mime of the file.
* @param {function(boolean)} onDialogClosed Called when the dialog is closed.
* The argument is the result of installation: true if an app is installed,
@@ -184,58 +184,32 @@
*/
SuggestAppsDialog.prototype.showByExtensionAndMime =
function(extension, mime, onDialogClosed) {
- assert(extension && extension[0] === '.');
- this.showInternal_(
- {
- file_extension: extension.substr(1),
- mime_type: mime
- },
- str('SUGGEST_DIALOG_TITLE'),
- FileTasks.createWebStoreLink(extension, mime),
- onDialogClosed);
-};
-
-/**
- * Shows suggest-apps dialog for FSP API
- * @param {function(boolean)} onDialogClosed Called when the dialog is closed.
- * The argument is the result of installation: true if an app is installed,
- * false otherwise.
- */
-SuggestAppsDialog.prototype.showProviders = function(onDialogClosed) {
- this.showInternal_(
- {
- file_system_provider: true
- },
- str('SUGGEST_DIALOG_FOR_PROVIDERS_TITLE'),
- null /* webStoreUrl */,
- onDialogClosed);
+ this.text_.hidden = true;
+ this.dialogText_ = '';
+ this.showInternal_(null, extension, mime, onDialogClosed);
};
/**
* Internal method to show a dialog. This should be called only from 'Suggest.
* appDialog.showXxxx()' functions.
*
- * @param {!Object<string, *>} options Map of options for the dialog.
- * @param {string} title Title of the dialog.
- * @param {?string} webStoreUrl Url for more results. Null if not supported.
+ * @param {?string} filename Filename (without extension) of the file.
+ * @param {?string} extension Extension of the file.
+ * @param {?string} mime Mime of the file.
* @param {function(boolean)} onDialogClosed Called when the dialog is closed.
* The argument is the result of installation: true if an app is installed,
* false otherwise.
* @private
*/
SuggestAppsDialog.prototype.showInternal_ =
- function(options, title, webStoreUrl, onDialogClosed) {
+ function(filename, extension, mime, onDialogClosed) {
if (this.state_ != SuggestAppsDialog.State.UNINITIALIZED) {
console.error('Invalid state.');
return;
}
- this.text_.hidden = true;
- this.webstoreButton_.hidden = (webStoreUrl === null);
- this.dialogText_ = '';
-
- this.webStoreUrl_ = webStoreUrl;
- this.options_ = options;
+ this.extension_ = extension;
+ this.mimeType_ = mime;
this.onDialogClosed_ = onDialogClosed;
this.state_ = SuggestAppsDialog.State.INITIALIZING;
@@ -250,6 +224,7 @@
return;
}
+ var title = str('SUGGEST_DIALOG_TITLE');
var show = this.dialogText_ ?
FileManagerDialogBase.prototype.showTitleAndTextDialog.call(
this, title, this.dialogText_) :
@@ -284,11 +259,9 @@
this.webviewClient_ = new CWSContainerClient(
this.webview_,
- WEBVIEW_WIDTH,
- WEBVIEW_HEIGHT,
- this.widgetUrl_,
- this.widgetOrigin_,
- this.options_);
+ extension, mime, filename,
+ WEBVIEW_WIDTH, WEBVIEW_HEIGHT,
+ this.widgetUrl_, this.widgetOrigin_);
this.webviewClient_.addEventListener(CWSContainerClient.Events.LOADED,
this.onWidgetLoaded_.bind(this));
this.webviewClient_.addEventListener(CWSContainerClient.Events.LOAD_FAILED,
@@ -306,9 +279,9 @@
* @private
*/
SuggestAppsDialog.prototype.onWebstoreLinkClicked_ = function(e) {
- if (!this.webStoreUrl_)
- return;
- util.visitURL(this.webStoreUrl_);
+ var webStoreUrl =
+ FileTasks.createWebStoreLink(this.extension_, this.mimeType_);
+ util.visitURL(webStoreUrl);
this.state_ = SuggestAppsDialog.State.OPENING_WEBSTORE_CLOSING;
this.hide();
};
@@ -454,8 +427,8 @@
this.webviewContainer_.removeChild(this.webview_);
this.webview_ = null;
- this.webStoreUrl_ = null;
- this.options_ = null;
+ this.extension_ = null;
+ this.mime_ = null;
FileManagerDialogBase.prototype.hide.call(
this,
diff --git a/ui/file_manager/file_manager/main.html b/ui/file_manager/file_manager/main.html
index b0b376f3..7f723d9459 100644
--- a/ui/file_manager/file_manager/main.html
+++ b/ui/file_manager/file_manager/main.html
@@ -251,9 +251,6 @@
<command id="inspect-console" shortcut="U+004A-Shift-Ctrl">
<command id="inspect-element" shortcut="U+0043-Shift-Ctrl">
<command id="inspect-background" shortcut="U+0042-Shift-Ctrl">
-
- <command id="add-new-services"
- i18n-values="label:ADD_NEW_SERVICES_BUTTON_LABEL">
</commands>
<cr-menu id="file-context-menu" class="chrome-menu" showShortcuts>
diff --git a/ui/file_manager/integration_tests/file_manager/copy_between_windows.js b/ui/file_manager/integration_tests/file_manager/copy_between_windows.js
index 0235463..4b72648 100644
--- a/ui/file_manager/integration_tests/file_manager/copy_between_windows.js
+++ b/ui/file_manager/integration_tests/file_manager/copy_between_windows.js
@@ -58,7 +58,7 @@
};
var REMOVABLE_VOLUME_QUERY = '#directory-tree > .tree-item > .tree-row ' +
- '.item-icon[volume-type-icon="removable"]';
+ '.volume-icon[volume-type-icon="removable"]';
testcase.copyBetweenWindowsDriveToLocal = function() {
var windowId1;
diff --git a/ui/file_manager/integration_tests/file_manager/file_display.js b/ui/file_manager/integration_tests/file_manager/file_display.js
index 54f9e48..e3d174ff 100644
--- a/ui/file_manager/integration_tests/file_manager/file_display.js
+++ b/ui/file_manager/integration_tests/file_manager/file_display.js
@@ -55,7 +55,7 @@
testcase.fileDisplayMtp = function() {
var appId;
var MTP_VOLUME_QUERY = '#directory-tree > .tree-item > .tree-row > ' +
- '.item-icon[volume-type-icon="mtp"]';
+ '.volume-icon[volume-type-icon="mtp"]';
StepsRunner.run([
function() {
diff --git a/ui/file_manager/integration_tests/file_manager/folder_shortcuts.js b/ui/file_manager/integration_tests/file_manager/folder_shortcuts.js
index a61d5a4..9e354360 100644
--- a/ui/file_manager/integration_tests/file_manager/folder_shortcuts.js
+++ b/ui/file_manager/integration_tests/file_manager/folder_shortcuts.js
@@ -15,7 +15,7 @@
var TREEITEM_D = TREEITEM_DRIVE + '> .tree-children > div:nth-child(2) ';
var TREEITEM_E = TREEITEM_D + '> .tree-children > div:nth-child(1) ';
var EXPAND_ICON = '> .tree-row > .expand-icon';
-var ITEM_ICON = '> .tree-row > .item-icon';
+var VOLUME_ICON = '> .tree-row > .volume-icon';
var EXPANDED_SUBTREE = '> .tree-children[expanded]';
/**
@@ -42,13 +42,13 @@
contents: [ENTRIES.directoryA.getExpectedRow(),
ENTRIES.directoryD.getExpectedRow()],
name: 'Drive',
- navItem: '#tree-item-autogen-id-3',
+ navItem: '#tree-item-autogen-id-2',
treeItem: TREEITEM_DRIVE
},
A: {
contents: [ENTRIES.directoryB.getExpectedRow()],
name: 'A',
- navItem: '#tree-item-autogen-id-14',
+ navItem: '#tree-item-autogen-id-13',
treeItem: TREEITEM_A
},
B: {
@@ -59,13 +59,13 @@
C: {
contents: [],
name: 'C',
- navItem: '#tree-item-autogen-id-14',
+ navItem: '#tree-item-autogen-id-13',
treeItem: TREEITEM_C
},
D: {
contents: [ENTRIES.directoryE.getExpectedRow()],
name: 'D',
- navItem: '#tree-item-autogen-id-13',
+ navItem: '#tree-item-autogen-id-12',
treeItem: TREEITEM_D
},
E: {
@@ -134,9 +134,9 @@
*/
function navigateToDirectory(windowId, directory) {
return remoteCall.waitForElement(
- windowId, directory.treeItem + ITEM_ICON).then(function() {
+ windowId, directory.treeItem + VOLUME_ICON).then(function() {
return remoteCall.callRemoteTestUtil(
- 'fakeMouseClick', windowId, [directory.treeItem + ITEM_ICON]);
+ 'fakeMouseClick', windowId, [directory.treeItem + VOLUME_ICON]);
}).then(function(result) {
chrome.test.assertTrue(result);
return remoteCall.waitForFiles(windowId, directory.contents);