From 698a1525a28f2875f171495f78012ab872e8e7a2 Mon Sep 17 00:00:00 2001 From: mfomitchev Date: Thu, 2 Apr 2015 13:38:00 -0700 Subject: [PATCH] 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} --- chrome/app/chromeos_strings.grdp | 6 -- .../extensions/file_manager/private_api_strings.cc | 4 - .../file_manager/foreground/css/file_manager.css | 2 +- .../file_manager/foreground/css/file_types.css | 6 -- .../foreground/images/volumes/2x/add.png | Bin 339 -> 0 bytes .../file_manager/foreground/images/volumes/add.png | Bin 217 -> 0 bytes .../foreground/js/cws_container_client.js | 20 ++-- .../file_manager/foreground/js/file_manager.js | 5 +- .../foreground/js/file_manager_commands.js | 15 --- .../foreground/js/navigation_list_model.js | 77 +++++++-------- .../foreground/js/ui/directory_tree.js | 109 +++------------------ .../foreground/js/ui/suggest_apps_dialog.js | 79 +++++---------- ui/file_manager/file_manager/main.html | 3 - .../file_manager/copy_between_windows.js | 2 +- .../integration_tests/file_manager/file_display.js | 2 +- .../file_manager/folder_shortcuts.js | 14 +-- 16 files changed, 101 insertions(+), 243 deletions(-) delete mode 100644 ui/file_manager/file_manager/foreground/images/volumes/2x/add.png delete mode 100644 ui/file_manager/file_manager/foreground/images/volumes/add.png diff --git a/chrome/app/chromeos_strings.grdp b/chrome/app/chromeos_strings.grdp index 1c179e63d8b1..8a58738ac37c 100644 --- a/chrome/app/chromeos_strings.grdp +++ b/chrome/app/chromeos_strings.grdp @@ -247,9 +247,6 @@ Press any key to continue exploring. Close - - Add new services - View @@ -684,9 +681,6 @@ Press any key to continue exploring. Select an app to open this file - - Available services - See more... 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 6606bc72ab12..9278fc504cf5 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 @@ bool FileManagerPrivateGetStringsFunction::RunSync() { 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 @@ bool FileManagerPrivateGetStringsFunction::RunSync() { 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 6b76816f7480..41b3ef5261e3 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 @@ div.splitter { 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 832173bd5e1e..fb39d5440724 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 @@ tree .tree-item[selected] > .tree-row > .shared[file-type-icon='folder'] { /* 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 08e26c11730ed01729369071ea0a4ef27a00cd43..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcwPel00001 literal 339 zcwPZh0j&OsP)Px$4M{{nR9FdPU>NCu5jg;&qoZXwIXSz4Vh%toi7ZD2_H&>a2fly*Ubb}U(kC$U z;0^#;&cVTPk&%&62qsAj`v3p`?|%IFp$~He6U-8j&uMKr$S#l_&`<_j4R-*L=KvO= z4*|Ce*#RWS`J6d(7(ti}H^c2hb^saXP_AXv0iz)>8Uh0z0xY<4GARWNF=|s%QvPGJ zYw(5uE*B&F0_JmK)FSIcW)FA>j5=U61V%$(z(WAJCOE$`SRsYT3TAmSXo&?(I5iEyf8T`(V$@8 l0_+t9!+J$jGIxj@0|5GxNUb1@vQYp4002ovPDHLkV1fhpd#eBd 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 9061c7d8c348c793e975636ef5a9638ccae5456b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcwPel00001 literal 217 zcwXxa@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|CVRR#hFAzD zCoB*!X!@eAs#wkH-vDwv&NSYvj6 zrg6JqizC-X#xq+Jm@lY$KIGrSsB_}n(WmhxAE!*2^539Vq?++4>j|~yoQ9h{dVHH@ zU4q{m7OG-{I%w8FdXUj1wmF2|JiEh)b_BbP0l+XkK2|-V^ 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 650f3c17407a..d177630e451e 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} 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 @@ CWSContainerClient.prototype.postInitializeMessage_ = function() { 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 c760fb2be759..2ccc3b968515 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 @@ FileManager.prototype = /** @struct */ { 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 85bf8a8faffc..0b8bdbea81a1 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 @@ CommandHandler.COMMANDS_['inspect-background'] = /** @type {Command} */ ({ }, 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 38f26719112b..5195f8676739 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 @@ function NavigationModelItem(label) { 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 @@ NavigationModelShortcutItem.prototype = { * @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 @@ function NavigationModelVolumeItem(label, volumeInfo) { // 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; } -}; - -/** - * 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; } + get isVolume() { return true; }, + get isShortcut() { return false; } }; /** - * 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 @@ NavigationListModel.prototype = { * @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 @@ NavigationListModel.prototype.item = function(index) { * @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 @@ NavigationListModel.prototype.indexOf = function(modelItem, opt_fromIndex) { * @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 3230707607e8..a699aa58951b 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 @@ function SubDirectoryItem(label, dirEntry, parentDirItem, tree) { // 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 @@ VolumeItem.prototype.isRemovable_ = function() { * @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 @@ function ShortcutItem(modelItem, tree) { 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 @@ ShortcutItem.prototype.activate = function() { }; //////////////////////////////////////////////////////////////////////////////// -// 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 @@ DirectoryTree.prototype.updateSubElementsFromList = function(recursive) { 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 @@ DirectoryTree.prototype.updateSubElementsFromList = function(recursive) { 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 bd356a0ecaf6..2c7c38c50ee7 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_WIDTH = 735; 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 @@ function SuggestAppsDialog(parentNode, state) { 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 @@ function SuggestAppsDialog(parentNode, state) { 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 @@ SuggestAppsDialog.prototype.show = function() { /** * 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.show = function() { */ 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} 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 @@ SuggestAppsDialog.prototype.showInternal_ = return; } + var title = str('SUGGEST_DIALOG_TITLE'); var show = this.dialogText_ ? FileManagerDialogBase.prototype.showTitleAndTextDialog.call( this, title, this.dialogText_) : @@ -284,11 +259,9 @@ SuggestAppsDialog.prototype.showInternal_ = 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 @@ SuggestAppsDialog.prototype.showInternal_ = * @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 @@ SuggestAppsDialog.prototype.hide = function(opt_originalOnHide) { 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 b0b376f37aab..7f723d9459ca 100644 --- a/ui/file_manager/file_manager/main.html +++ b/ui/file_manager/file_manager/main.html @@ -251,9 +251,6 @@ - - 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 023546354aa0..4b7264843fed 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 @@ function copyBetweenWindows(windowId1, windowId2, file) { }; 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 54f9e48c83ec..e3d174ffc50f 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.fileDisplayDrive = function() { 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 a61d5a411296..9e3543604bd7 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_C = TREEITEM_B + '> .tree-children > div:nth-child(1) '; 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 @@ var DIRECTORY = { 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 @@ var DIRECTORY = { 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 expandDirectoryTree(windowId) { */ 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); -- 2.11.4.GIT