Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Unified Diff: chrome/browser/ui/views/file_manager_dialogs.cc

Issue 6865033: Made full tab file browser to open automatically when a new disk device is properly mounted. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/file_manager_dialogs.cc
===================================================================
--- chrome/browser/ui/views/file_manager_dialogs.cc (revision 81745)
+++ chrome/browser/ui/views/file_manager_dialogs.cc (working copy)
@@ -8,6 +8,7 @@
#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/browser/extensions/extension_file_browser_private_api.h"
+#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_dialogs.h"
@@ -34,6 +35,9 @@
// Helper to convert numeric dialog type to a string.
static std::string GetDialogTypeAsString(Type dialog_type);
+ static void ShowFullTabUrl(Profile* profile,
+ const FilePath& default_path);
+
// Help to convert potential dialog arguments into json.
static std::string GetArgumentsJson(
Type type,
@@ -66,7 +70,6 @@
}
// SelectFileDialog implementation.
-
virtual void SelectFile(Type type,
const string16& title,
const FilePath& default_path,
@@ -177,6 +180,21 @@
listener_ = listener;
}
+void FileManagerDialog::ShowFullTabUrl(Profile* profile,
+ const FilePath& default_path) {
+ std::string json = GetArgumentsJson(SELECT_NONE, string16(), default_path,
+ NULL, 0, FilePath::StringType());
+ GURL url(s_extension_base_url_ + "?" +
+ UrlEncodeStringWithoutEncodingSpaceAsPlus(json));
+ Browser* browser = BrowserList::GetLastActive();
+ if (!browser)
+ return;
+
+ UserMetrics::RecordAction(UserMetricsAction("ShowFileBrowserFullTab"),
+ profile);
+ browser->ShowSingletonTab(GURL(url));
+}
+
void FileManagerDialog::SelectFile(
Type type,
const string16& title,
@@ -259,6 +277,7 @@
DictionaryValue arg_value;
arg_value.SetString("type", GetDialogTypeAsString(type));
arg_value.SetString("title", title);
+ // TODO(zelidrag): Convert local system path into virtual path for File API.
arg_value.SetString("defaultPath", default_path.value());
arg_value.SetString("defaultExtension", default_extension);

Powered by Google App Engine
This is Rietveld 408576698