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); |