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

Unified Diff: chrome/browser/media_galleries/media_galleries_dialog_controller.cc

Issue 46973005: Media Galleries: Use the same last directory entry as file_system_api. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 1 month 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
« no previous file with comments | « chrome/browser/media_galleries/media_galleries_dialog_controller.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/media_galleries/media_galleries_dialog_controller.cc
===================================================================
--- chrome/browser/media_galleries/media_galleries_dialog_controller.cc (revision 232670)
+++ chrome/browser/media_galleries/media_galleries_dialog_controller.cc (working copy)
@@ -9,6 +9,8 @@
#include "base/stl_util.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/extensions/api/file_system/file_system_api.h"
+#include "chrome/browser/extensions/extension_prefs.h"
#include "chrome/browser/media_galleries/media_file_system_registry.h"
#include "chrome/browser/media_galleries/media_galleries_histograms.h"
#include "chrome/browser/profiles/profile.h"
@@ -88,7 +90,7 @@
on_finish_(on_finish) {
preferences_ =
g_browser_process->media_file_system_registry()->GetPreferences(
- Profile::FromBrowserContext(web_contents_->GetBrowserContext()));
+ GetProfile());
// Passing unretained pointer is safe, since the dialog controller
// is self-deleting, and so won't be deleted until it can be shown
// and then closed.
@@ -209,14 +211,17 @@
}
void MediaGalleriesDialogController::OnAddFolderClicked() {
- base::FilePath desktop;
- PathService::Get(base::DIR_USER_DESKTOP, &desktop);
+ base::FilePath default_path =
+ extensions::file_system_api::GetLastChooseEntryDirectory(
+ extensions::ExtensionPrefs::Get(GetProfile()), extension_->id());
+ if (default_path.empty())
+ PathService::Get(base::DIR_USER_DESKTOP, &default_path);
select_folder_dialog_ =
ui::SelectFileDialog::Create(this, new ChromeSelectFilePolicy(NULL));
select_folder_dialog_->SelectFile(
ui::SelectFileDialog::SELECT_FOLDER,
l10n_util::GetStringUTF16(IDS_MEDIA_GALLERIES_DIALOG_ADD_GALLERY_TITLE),
- desktop,
+ default_path,
NULL,
0,
base::FilePath::StringType(),
@@ -287,6 +292,11 @@
void MediaGalleriesDialogController::FileSelected(const base::FilePath& path,
int /*index*/,
void* /*params*/) {
+ extensions::file_system_api::SetLastChooseEntryDirectory(
+ extensions::ExtensionPrefs::Get(GetProfile()),
+ extension_->id(),
+ path);
+
// Try to find it in the prefs.
MediaGalleryPrefInfo gallery;
bool gallery_exists = preferences_->LookUpGalleryByPath(path, &gallery);
@@ -466,6 +476,10 @@
return context_menu_model_.get();
}
+Profile* MediaGalleriesDialogController::GetProfile() {
+ return Profile::FromBrowserContext(web_contents_->GetBrowserContext());
+}
+
// MediaGalleries dialog -------------------------------------------------------
MediaGalleriesDialog::~MediaGalleriesDialog() {}
« no previous file with comments | « chrome/browser/media_galleries/media_galleries_dialog_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698