summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authordbeam@chromium.org <dbeam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-05 21:45:42 +0000
committerdbeam@chromium.org <dbeam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-05 21:45:42 +0000
commit66495020df687ba383fdb57997ed6349af19ebcc (patch)
tree9bcc221db99a28da54e16cfdc103f209e3ce10f2 /chrome/browser
parentcb0541c72761095f43d9772c144010ed534d63a5 (diff)
downloadchromium_src-66495020df687ba383fdb57997ed6349af19ebcc.zip
chromium_src-66495020df687ba383fdb57997ed6349af19ebcc.tar.gz
chromium_src-66495020df687ba383fdb57997ed6349af19ebcc.tar.bz2
Revert 124975 - [filebrowser] Introduce "Open" action for supported file types (e.g. pdf).
Was breaking ChromeOS, failing tests were: - FileSystemExtensionApiTest.FileBrowserTest - FileSystemExtensionApiTest.FileBrowserTestWrite - FileSystemExtensionApiTest.FileBrowserTestWriteComponent BUG=chromium-os:26538,chromium-os:26539 TEST=See bug. Review URL: http://codereview.chromium.org/9395077 TBR=dgozman@chromium.org Review URL: https://chromiumcodereview.appspot.com/9594037 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@125002 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/chromeos/extensions/file_browser_private_api.cc7
-rw-r--r--chrome/browser/chromeos/extensions/file_manager_util.cc46
-rw-r--r--chrome/browser/chromeos/extensions/file_manager_util.h2
-rw-r--r--chrome/browser/resources/file_manager/js/file_manager.js24
-rw-r--r--chrome/browser/resources/file_manager/js/mock_chrome.js3
-rw-r--r--chrome/browser/resources/file_manager/manifest.json27
6 files changed, 27 insertions, 82 deletions
diff --git a/chrome/browser/chromeos/extensions/file_browser_private_api.cc b/chrome/browser/chromeos/extensions/file_browser_private_api.cc
index 1e6536b..117c237 100644
--- a/chrome/browser/chromeos/extensions/file_browser_private_api.cc
+++ b/chrome/browser/chromeos/extensions/file_browser_private_api.cc
@@ -1781,9 +1781,6 @@ bool FileDialogStringsFunction::RunImpl() {
SET_STRING(IDS_FILE_BROWSER, MOUNT_ARCHIVE);
SET_STRING(IDS_FILE_BROWSER, FORMAT_DEVICE);
- SET_STRING(IDS_FILE_BROWSER, OPEN_ACTION);
- SET_STRING(IDS_FILE_BROWSER, INSTALL_CRX);
-
SET_STRING(IDS_FILE_BROWSER, GALLERY);
SET_STRING(IDS_FILE_BROWSER, GALLERY_EDIT);
SET_STRING(IDS_FILE_BROWSER, GALLERY_SHARE);
@@ -1915,10 +1912,6 @@ bool FileDialogStringsFunction::RunImpl() {
SET_STRING(IDS_FILE_BROWSER, ENQUEUE);
#undef SET_STRING
- dict->SetString("PDF_VIEW_ENABLED",
- file_manager_util::ShouldBeOpenedWithPdfPlugin(".pdf") ?
- "true" : "false");
-
ChromeURLDataManager::DataSource::SetFontAndTextDirection(dict);
dict->SetString("PLAY_MEDIA",
diff --git a/chrome/browser/chromeos/extensions/file_manager_util.cc b/chrome/browser/chromeos/extensions/file_manager_util.cc
index 08467fd..e4de851 100644
--- a/chrome/browser/chromeos/extensions/file_manager_util.cc
+++ b/chrome/browser/chromeos/extensions/file_manager_util.cc
@@ -122,6 +122,29 @@ bool IsCRXFile(const char* file_extension) {
return base::strcasecmp(file_extension, kCRXExtension) == 0;
}
+// If pdf plugin is enabled, we should open pdf files in a tab.
+bool ShouldBeOpenedWithPdfPlugin(const char* file_extension) {
+ if (base::strcasecmp(file_extension, kPdfExtension) != 0)
+ return false;
+
+ Browser* browser = BrowserList::GetLastActive();
+ if (!browser)
+ return false;
+
+ FilePath pdf_path;
+ PathService::Get(chrome::FILE_PDF_PLUGIN, &pdf_path);
+
+ webkit::WebPluginInfo plugin;
+ if (!PluginService::GetInstance()->GetPluginInfoByPath(pdf_path, &plugin))
+ return false;
+
+ PluginPrefs* plugin_prefs = PluginPrefs::GetForProfile(browser->profile());
+ if (!plugin_prefs)
+ return false;
+
+ return plugin_prefs->IsPluginEnabled(plugin);
+}
+
// Returns index |ext| has in the |array|. If there is no |ext| in |array|, last
// element's index is return (last element should have irrelevant value).
int UMAExtensionIndex(const char *file_extension,
@@ -445,27 +468,4 @@ void InstallCRX(Profile* profile, const FilePath& full_path) {
installer->InstallCrx(full_path);
}
-// If pdf plugin is enabled, we should open pdf files in a tab.
-bool ShouldBeOpenedWithPdfPlugin(const char* file_extension) {
- if (base::strcasecmp(file_extension, kPdfExtension) != 0)
- return false;
-
- Browser* browser = BrowserList::GetLastActive();
- if (!browser)
- return false;
-
- FilePath pdf_path;
- PathService::Get(chrome::FILE_PDF_PLUGIN, &pdf_path);
-
- webkit::WebPluginInfo plugin;
- if (!PluginService::GetInstance()->GetPluginInfoByPath(pdf_path, &plugin))
- return false;
-
- PluginPrefs* plugin_prefs = PluginPrefs::GetForProfile(browser->profile());
- if (!plugin_prefs)
- return false;
-
- return plugin_prefs->IsPluginEnabled(plugin);
-}
-
} // namespace file_manager_util
diff --git a/chrome/browser/chromeos/extensions/file_manager_util.h b/chrome/browser/chromeos/extensions/file_manager_util.h
index 7e520ef..689b0f2 100644
--- a/chrome/browser/chromeos/extensions/file_manager_util.h
+++ b/chrome/browser/chromeos/extensions/file_manager_util.h
@@ -66,8 +66,6 @@ bool TryViewingFile(const FilePath& file);
void InstallCRX(Profile* profile, const FilePath& full_path);
-bool ShouldBeOpenedWithPdfPlugin(const char* file_extension);
-
} // namespace file_manager_util
#endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_UTIL_H_
diff --git a/chrome/browser/resources/file_manager/js/file_manager.js b/chrome/browser/resources/file_manager/js/file_manager.js
index ada15f3..001348f 100644
--- a/chrome/browser/resources/file_manager/js/file_manager.js
+++ b/chrome/browser/resources/file_manager/js/file_manager.js
@@ -2164,7 +2164,6 @@ FileManager.prototype = {
FileManager.prototype.onTasksFound_ = function(selection, tasksList) {
this.taskItems_.clear();
- var tasksCount = 0;
for (var i = 0; i < tasksList.length; i++) {
var task = tasksList[i];
@@ -2186,30 +2185,15 @@ FileManager.prototype = {
} else if (task_parts[1] == 'gallery') {
task.iconUrl =
chrome.extension.getURL('images/icon_preview_16x16.png');
- task.title = str('OPEN_ACTION');
+ task.title = str('GALLERY');
task.allTasks = tasksList;
- } else if (task_parts[1] == 'view-pdf') {
- // Do not render this task if disabled.
- if (str('PDF_VIEW_ENABLED') == 'false') continue;
- task.iconUrl =
- chrome.extension.getURL('images/icon_preview_16x16.png');
- task.title = str('OPEN_ACTION');
- } else if (task_parts[1] == 'view-txt') {
- task.iconUrl =
- chrome.extension.getURL('images/icon_preview_16x16.png');
- task.title = str('OPEN_ACTION');
- } else if (task_parts[1] == 'install-crx') {
- // TODO(dgozman): change to the right icon.
- task.iconUrl =
- chrome.extension.getURL('images/icon_preview_16x16.png');
- task.title = str('INSTALL_CRX');
+ this.galleryTask_ = task;
}
}
this.renderTaskItem_(task);
- tasksCount++;
}
- this.taskItems_.visible = tasksCount > 0;
+ this.taskItems_.visible = tasksList.length > 0;
selection.tasksList = tasksList;
if (selection.dispatchDefault) {
@@ -2461,8 +2445,6 @@ FileManager.prototype = {
}
}
this.openGallery_(urls, noGallery);
- } else if (id == 'view-pdf' || id == 'view-txt' || id == 'install-crx') {
- chrome.fileBrowserPrivate.viewFiles(urls, 'default', function() {});
}
};
diff --git a/chrome/browser/resources/file_manager/js/mock_chrome.js b/chrome/browser/resources/file_manager/js/mock_chrome.js
index 0621179..922ef33 100644
--- a/chrome/browser/resources/file_manager/js/mock_chrome.js
+++ b/chrome/browser/resources/file_manager/js/mock_chrome.js
@@ -322,9 +322,6 @@ chrome.fileBrowserPrivate = {
MOUNT_ARCHIVE: 'Open',
FORMAT_DEVICE: 'Format device',
- OPEN_ACTION: 'Open',
- INSTALL_CRX: 'Open',
-
GALLERY: 'View and Edit',
GALLERY_EDIT: 'Edit',
GALLERY_SHARE: 'Share',
diff --git a/chrome/browser/resources/file_manager/manifest.json b/chrome/browser/resources/file_manager/manifest.json
index b1ef6ee..34fbea4 100644
--- a/chrome/browser/resources/file_manager/manifest.json
+++ b/chrome/browser/resources/file_manager/manifest.json
@@ -56,33 +56,8 @@
]
},
{
- "id": "view-pdf",
- "default_title": "__MSG_OPEN_ACTION__",
- "default_icon": "images/icon_preview_16x16.png",
- "file_filters": [
- "filesystem:*.pdf"
- ]
- },
- {
- "id": "view-txt",
- "default_title": "__MSG_OPEN_ACTION__",
- "default_icon": "images/icon_preview_16x16.png",
- "file_filters": [
- "filesystem:*.txt"
- ]
- },
- {
- "id": "install-crx",
- "default_title": "__MSG_INSTALL_CRX__",
- // TODO(dgozman): replace to the right icon.
- "default_icon": "images/icon_preview_16x16.png",
- "file_filters": [
- "filesystem:*.crx"
- ]
- },
- {
"id": "gallery",
- "default_title": "__MSG_OPEN_ACTION__",
+ "default_title": "__MSG_GALLERY__",
"default_icon": "images/icon_preview_16x16.png",
"file_filters": [
// Image formats