Commit d557fa05 authored by vandebo@chromium.org's avatar vandebo@chromium.org

Rename media gallery -> media galleries in pref/UI components.

Also rename registry to preferences.


BUG=NONE


Review URL: https://chromiumcodereview.appspot.com/10835016

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@148808 0039d316-1c4b-4281-b951-d872f2087c98
parent 2ba3b745
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/media_gallery/media_gallery_registry.h"
#include "chrome/browser/media_gallery/media_galleries_preferences.h"
#include "base/command_line.h"
#include "base/string_number_conversions.h"
......@@ -16,13 +16,13 @@
namespace {
const char kMediaGalleryIdKey[] = "id";
const char kMediaGalleryPathKey[] = "path";
const char kMediaGalleryDisplayNameKey[] = "displayName";
const char kMediaGalleriesIdKey[] = "id";
const char kMediaGalleriesPathKey[] = "path";
const char kMediaGalleriesDisplayNameKey[] = "displayName";
bool GetId(const DictionaryValue* dict, uint64* value) {
std::string string_id;
if (!dict->GetString(kMediaGalleryIdKey, &string_id) ||
if (!dict->GetString(kMediaGalleriesIdKey, &string_id) ||
!base::StringToUint64(string_id, value)) {
return false;
}
......@@ -36,8 +36,8 @@ bool PopulateGalleryFromDictionary(const DictionaryValue* dict,
FilePath::StringType path;
string16 display_name;
if (!GetId(dict, &id) ||
!dict->GetString(kMediaGalleryPathKey, &path) ||
!dict->GetString(kMediaGalleryDisplayNameKey, &display_name)) {
!dict->GetString(kMediaGalleriesPathKey, &path) ||
!dict->GetString(kMediaGalleriesDisplayNameKey, &display_name)) {
return false;
}
......@@ -49,10 +49,10 @@ bool PopulateGalleryFromDictionary(const DictionaryValue* dict,
DictionaryValue* CreateGalleryDictionary(const MediaGallery& gallery) {
DictionaryValue* dict = new DictionaryValue();
dict->SetString(kMediaGalleryIdKey, base::Uint64ToString(gallery.id));
dict->SetString(kMediaGalleryPathKey, gallery.path.value());
dict->SetString(kMediaGalleriesIdKey, base::Uint64ToString(gallery.id));
dict->SetString(kMediaGalleriesPathKey, gallery.path.value());
// TODO(estade): save |path| and |identifier|.
dict->SetString(kMediaGalleryDisplayNameKey, gallery.display_name);
dict->SetString(kMediaGalleriesDisplayNameKey, gallery.display_name);
return dict;
}
......@@ -61,20 +61,20 @@ DictionaryValue* CreateGalleryDictionary(const MediaGallery& gallery) {
MediaGallery::MediaGallery() : id(0) {}
MediaGallery::~MediaGallery() {}
MediaGalleryRegistry::MediaGalleryRegistry(Profile* profile)
MediaGalleriesPreferences::MediaGalleriesPreferences(Profile* profile)
: profile_(profile) {
DCHECK(UserInteractionIsEnabled());
InitFromPrefs();
}
MediaGalleryRegistry::~MediaGalleryRegistry() {}
MediaGalleriesPreferences::~MediaGalleriesPreferences() {}
void MediaGalleryRegistry::InitFromPrefs() {
void MediaGalleriesPreferences::InitFromPrefs() {
remembered_galleries_.clear();
PrefService* prefs = profile_->GetPrefs();
const ListValue* list = prefs->GetList(
prefs::kMediaGalleryRememberedGalleries);
prefs::kMediaGalleriesRememberedGalleries);
for (ListValue::const_iterator it = list->begin(); it != list->end(); it++) {
const DictionaryValue* dict = NULL;
......@@ -87,27 +87,27 @@ void MediaGalleryRegistry::InitFromPrefs() {
}
}
void MediaGalleryRegistry::AddGalleryByPath(const FilePath& path) {
void MediaGalleriesPreferences::AddGalleryByPath(const FilePath& path) {
PrefService* prefs = profile_->GetPrefs();
MediaGallery gallery;
gallery.id = prefs->GetUint64(prefs::kMediaGalleryUniqueId);
prefs->SetUint64(prefs::kMediaGalleryUniqueId, gallery.id + 1);
gallery.id = prefs->GetUint64(prefs::kMediaGalleriesUniqueId);
prefs->SetUint64(prefs::kMediaGalleriesUniqueId, gallery.id + 1);
gallery.display_name = path.BaseName().LossyDisplayName();
// TODO(estade): make this relative to base_path.
gallery.path = path;
// TODO(estade): populate the rest of the fields.
ListPrefUpdate update(prefs, prefs::kMediaGalleryRememberedGalleries);
ListPrefUpdate update(prefs, prefs::kMediaGalleriesRememberedGalleries);
ListValue* list = update.Get();
list->Append(CreateGalleryDictionary(gallery));
remembered_galleries_.push_back(gallery);
}
void MediaGalleryRegistry::ForgetGalleryById(uint64 id) {
void MediaGalleriesPreferences::ForgetGalleryById(uint64 id) {
PrefService* prefs = profile_->GetPrefs();
ListPrefUpdate update(prefs, prefs::kMediaGalleryRememberedGalleries);
ListPrefUpdate update(prefs, prefs::kMediaGalleriesRememberedGalleries);
ListValue* list = update.Get();
for (ListValue::iterator iter = list->begin(); iter != list->end(); ++iter) {
......@@ -122,23 +122,23 @@ void MediaGalleryRegistry::ForgetGalleryById(uint64 id) {
}
}
void MediaGalleryRegistry::Shutdown() {
void MediaGalleriesPreferences::Shutdown() {
profile_ = NULL;
}
// static
bool MediaGalleryRegistry::UserInteractionIsEnabled() {
bool MediaGalleriesPreferences::UserInteractionIsEnabled() {
return CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableMediaGalleryUI);
}
// static
void MediaGalleryRegistry::RegisterUserPrefs(PrefService* prefs) {
void MediaGalleriesPreferences::RegisterUserPrefs(PrefService* prefs) {
if (!UserInteractionIsEnabled())
return;
prefs->RegisterListPref(prefs::kMediaGalleryRememberedGalleries,
prefs->RegisterListPref(prefs::kMediaGalleriesRememberedGalleries,
PrefService::UNSYNCABLE_PREF);
prefs->RegisterUint64Pref(prefs::kMediaGalleryUniqueId, 0,
prefs->RegisterUint64Pref(prefs::kMediaGalleriesUniqueId, 0,
PrefService::UNSYNCABLE_PREF);
}
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_MEDIA_GALLERY_MEDIA_GALLERY_REGISTRY_H_
#define CHROME_BROWSER_MEDIA_GALLERY_MEDIA_GALLERY_REGISTRY_H_
#ifndef CHROME_BROWSER_MEDIA_GALLERY_MEDIA_GALLERIES_PREFERENCES_H_
#define CHROME_BROWSER_MEDIA_GALLERY_MEDIA_GALLERIES_PREFERENCES_H_
#include <list>
#include <string>
......@@ -44,10 +44,12 @@ struct MediaGallery {
// A class to manage the media galleries that the user has added, explicitly or
// otherwise. There is one registry per user profile.
// TODO(estade): should MediaFileSystemRegistry be merged into this class?
class MediaGalleryRegistry : public ProfileKeyedService {
class MediaGalleriesPreferences : public ProfileKeyedService {
public:
explicit MediaGalleryRegistry(Profile* profile);
virtual ~MediaGalleryRegistry();
typedef std::list<MediaGallery> MediaGalleries;
explicit MediaGalleriesPreferences(Profile* profile);
virtual ~MediaGalleriesPreferences();
// Builds |remembered_galleries_| from the persistent store.
void InitFromPrefs();
......@@ -59,8 +61,6 @@ class MediaGalleryRegistry : public ProfileKeyedService {
// Removes the gallery identified by |id| from the store.
void ForgetGalleryById(uint64 id);
typedef std::list<MediaGallery> MediaGalleries;
const MediaGalleries& remembered_galleries() const {
return remembered_galleries_;
}
......@@ -81,7 +81,7 @@ class MediaGalleryRegistry : public ProfileKeyedService {
// TODO(estade): either actually use this, or remove it.
MediaGalleries remembered_galleries_;
DISALLOW_COPY_AND_ASSIGN(MediaGalleryRegistry);
DISALLOW_COPY_AND_ASSIGN(MediaGalleriesPreferences);
};
#endif // CHROME_BROWSER_MEDIA_GALLERY_MEDIA_GALLERY_REGISTRY_H_
#endif // CHROME_BROWSER_MEDIA_GALLERY_MEDIA_GALLERIES_PREFERENCES_H_
......@@ -2,38 +2,39 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/media_gallery/media_gallery_registry_factory.h"
#include "chrome/browser/media_gallery/media_galleries_preferences_factory.h"
#include "chrome/browser/media_gallery/media_gallery_registry.h"
#include "chrome/browser/media_gallery/media_galleries_preferences.h"
#include "chrome/browser/profiles/profile_dependency_manager.h"
// static
MediaGalleryRegistry* MediaGalleryRegistryFactory::GetForProfile(
MediaGalleriesPreferences* MediaGalleriesPreferencesFactory::GetForProfile(
Profile* profile) {
return static_cast<MediaGalleryRegistry*>(
return static_cast<MediaGalleriesPreferences*>(
GetInstance()->GetServiceForProfile(profile, true));
}
// static
MediaGalleryRegistryFactory* MediaGalleryRegistryFactory::GetInstance() {
return Singleton<MediaGalleryRegistryFactory>::get();
MediaGalleriesPreferencesFactory*
MediaGalleriesPreferencesFactory::GetInstance() {
return Singleton<MediaGalleriesPreferencesFactory>::get();
}
MediaGalleryRegistryFactory::MediaGalleryRegistryFactory()
: ProfileKeyedServiceFactory("MediaGalleryRegistry",
MediaGalleriesPreferencesFactory::MediaGalleriesPreferencesFactory()
: ProfileKeyedServiceFactory("MediaGalleriesPreferences",
ProfileDependencyManager::GetInstance()) {}
MediaGalleryRegistryFactory::~MediaGalleryRegistryFactory() {}
MediaGalleriesPreferencesFactory::~MediaGalleriesPreferencesFactory() {}
ProfileKeyedService* MediaGalleryRegistryFactory::BuildServiceInstanceFor(
ProfileKeyedService* MediaGalleriesPreferencesFactory::BuildServiceInstanceFor(
Profile* profile) const {
return new MediaGalleryRegistry(profile);
return new MediaGalleriesPreferences(profile);
}
void MediaGalleryRegistryFactory::RegisterUserPrefs(PrefService* prefs) {
MediaGalleryRegistry::RegisterUserPrefs(prefs);
void MediaGalleriesPreferencesFactory::RegisterUserPrefs(PrefService* prefs) {
MediaGalleriesPreferences::RegisterUserPrefs(prefs);
}
bool MediaGalleryRegistryFactory::ServiceRedirectedInIncognito() {
bool MediaGalleriesPreferencesFactory::ServiceRedirectedInIncognito() {
return true;
}
......@@ -2,29 +2,29 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_MEDIA_GALLERY_MEDIA_GALLERY_REGISTRY_FACTORY_H_
#define CHROME_BROWSER_MEDIA_GALLERY_MEDIA_GALLERY_REGISTRY_FACTORY_H_
#ifndef CHROME_BROWSER_MEDIA_GALLERY_MEDIA_GALLERIES_PREFERENCES_FACTORY_H_
#define CHROME_BROWSER_MEDIA_GALLERY_MEDIA_GALLERIES_PREFERENCES_FACTORY_H_
#include "base/basictypes.h"
#include "base/memory/singleton.h"
#include "chrome/browser/profiles/profile_keyed_service_factory.h"
class Profile;
class MediaGalleryRegistry;
class MediaGalleriesPreferences;
// Singleton that owns all MediaGalleryRegistries and associates them with
// Singleton that owns all MediaGalleriesPreferences and associates them with
// Profiles.
class MediaGalleryRegistryFactory : public ProfileKeyedServiceFactory {
class MediaGalleriesPreferencesFactory : public ProfileKeyedServiceFactory {
public:
static MediaGalleryRegistry* GetForProfile(Profile* profile);
static MediaGalleriesPreferences* GetForProfile(Profile* profile);
static MediaGalleryRegistryFactory* GetInstance();
static MediaGalleriesPreferencesFactory* GetInstance();
private:
friend struct DefaultSingletonTraits<MediaGalleryRegistryFactory>;
friend struct DefaultSingletonTraits<MediaGalleriesPreferencesFactory>;
MediaGalleryRegistryFactory();
virtual ~MediaGalleryRegistryFactory();
MediaGalleriesPreferencesFactory();
virtual ~MediaGalleriesPreferencesFactory();
// ProfileKeyedServiceFactory:
virtual ProfileKeyedService* BuildServiceInstanceFor(
......@@ -32,7 +32,7 @@ class MediaGalleryRegistryFactory : public ProfileKeyedServiceFactory {
virtual void RegisterUserPrefs(PrefService* prefs) OVERRIDE;
virtual bool ServiceRedirectedInIncognito() OVERRIDE;
DISALLOW_COPY_AND_ASSIGN(MediaGalleryRegistryFactory);
DISALLOW_COPY_AND_ASSIGN(MediaGalleriesPreferencesFactory);
};
#endif // CHROME_BROWSER_MEDIA_GALLERY_MEDIA_GALLERY_REGISTRY_FACTORY_H_
#endif // CHROME_BROWSER_MEDIA_GALLERY_MEDIA_GALLERIES_PREFERENCES_FACTORY_H_
......@@ -22,7 +22,7 @@
#include "chrome/browser/history/history_service_factory.h"
#include "chrome/browser/history/shortcuts_backend_factory.h"
#include "chrome/browser/intents/web_intents_registry_factory.h"
#include "chrome/browser/media_gallery/media_gallery_registry_factory.h"
#include "chrome/browser/media_gallery/media_galleries_preferences_factory.h"
#include "chrome/browser/notifications/desktop_notification_service_factory.h"
#include "chrome/browser/password_manager/password_store_factory.h"
#include "chrome/browser/plugin_prefs_factory.h"
......@@ -225,7 +225,7 @@ void ProfileDependencyManager::AssertFactoriesBuilt() {
#if defined(ENABLE_CONFIGURATION_POLICY)
ManagedModePolicyProviderFactory::GetInstance();
#endif
MediaGalleryRegistryFactory::GetInstance();
MediaGalleriesPreferencesFactory::GetInstance();
NTPResourceCacheFactory::GetInstance();
PasswordStoreFactory::GetInstance();
PersonalDataManagerFactory::GetInstance();
......
......@@ -318,7 +318,7 @@
i18n-content="manage_exceptions"></button>
</div>
</section>
<section id="media-gallery-section" hidden>
<section id="media-galleries-section" hidden>
<h3 i18n-content="mediaGalleriesSectionLabel"></h3>
<div>
<button id="manage-galleries-button"
......
......@@ -10,15 +10,15 @@ cr.define('options', function() {
* @constructor
* @extends {DeletableItem}
*/
function MediaGalleryListItem(galleryInfo) {
function MediaGalleriesListItem(galleryInfo) {
var el = cr.doc.createElement('div');
el.galleryInfo_ = galleryInfo;
el.__proto__ = MediaGalleryListItem.prototype;
el.__proto__ = MediaGalleriesListItem.prototype;
el.decorate();
return el;
}
MediaGalleryListItem.prototype = {
MediaGalleriesListItem.prototype = {
__proto__: DeletableItem.prototype,
decorate: function() {
......@@ -31,9 +31,9 @@ cr.define('options', function() {
},
};
var MediaGalleryList = cr.ui.define('list');
var MediaGalleriesList = cr.ui.define('list');
MediaGalleryList.prototype = {
MediaGalleriesList.prototype = {
__proto__: DeletableItemList.prototype,
/** @inheritDoc */
......@@ -44,7 +44,7 @@ cr.define('options', function() {
/** @inheritDoc */
createItem: function(galleryInfo) {
return new MediaGalleryListItem(galleryInfo);
return new MediaGalleriesListItem(galleryInfo);
},
/** @inheritDoc */
......@@ -54,6 +54,6 @@ cr.define('options', function() {
};
return {
MediaGalleryList: MediaGalleryList
MediaGalleriesList: MediaGalleriesList
};
});
......@@ -12,15 +12,15 @@ cr.define('options', function() {
* @constructor
* @extends {OptionsPage}
*/
function MediaGalleryManager() {
function MediaGalleriesManager() {
OptionsPage.call(this, 'manageGalleries',
loadTimeData.getString('manageMediaGalleriesTabTitle'),
'manage-media-galleries-overlay');
}
cr.addSingletonGetter(MediaGalleryManager);
cr.addSingletonGetter(MediaGalleriesManager);
MediaGalleryManager.prototype = {
MediaGalleriesManager.prototype = {
__proto__: OptionsPage.prototype,
/**
......@@ -30,7 +30,7 @@ cr.define('options', function() {
OptionsPage.prototype.initializePage.call(this);
this.availableGalleriesList_ = $('available-galleries-list');
options.MediaGalleryList.decorate(this.availableGalleriesList_);
options.MediaGalleriesList.decorate(this.availableGalleriesList_);
$('new-media-gallery').addEventListener('click', function() {
chrome.send('addNewGallery');
......@@ -61,7 +61,7 @@ cr.define('options', function() {
setAvailableMediaGalleries_: function(galleries) {
$('available-galleries-list').dataModel = new ArrayDataModel(galleries);
// TODO(estade): show this section by default.
$('media-gallery-section').hidden = false;
$('media-galleries-section').hidden = false;
},
},
......@@ -69,14 +69,14 @@ cr.define('options', function() {
[
'setAvailableMediaGalleries',
].forEach(function(name) {
MediaGalleryManager[name] = function() {
var instance = MediaGalleryManager.getInstance();
MediaGalleriesManager[name] = function() {
var instance = MediaGalleriesManager.getInstance();
return instance[name + '_'].apply(instance, arguments);
};
});
// Export
return {
MediaGalleryManager: MediaGalleryManager
MediaGalleriesManager: MediaGalleriesManager
};
});
......@@ -117,7 +117,7 @@
<include src="cookies_view_app.html">
<include src="handler_options.html">
<include src="language_add_language_overlay.html">
<include src="media_gallery_manager_overlay.html">
<include src="media_galleries_manager_overlay.html">
<if expr="pp_ifdef('chromeos')">
<include src="chromeos/internet_detail.html">
<include src="chromeos/preferred_networks.html">
......
......@@ -20,7 +20,7 @@ var HomePageOverlay = options.HomePageOverlay;
var ImportDataOverlay = options.ImportDataOverlay;
var InstantConfirmOverlay = options.InstantConfirmOverlay;
var LanguageOptions = options.LanguageOptions;
var MediaGalleryManager = options.MediaGalleryManager;
var MediaGalleriesManager = options.MediaGalleriesManager;
var OptionsFocusManager = options.OptionsFocusManager;
var OptionsPage = options.OptionsPage;
var PasswordManager = options.PasswordManager;
......@@ -104,7 +104,7 @@ function load() {
[$('language-button')]);
OptionsPage.registerOverlay(ManageProfileOverlay.getInstance(),
BrowserOptions.getInstance());
OptionsPage.registerOverlay(MediaGalleryManager.getInstance(),
OptionsPage.registerOverlay(MediaGalleriesManager.getInstance(),
ContentSettings.getInstance(),
[$('manage-galleries-button')]);
OptionsPage.registerOverlay(PasswordManager.getInstance(),
......
......@@ -83,8 +83,8 @@
<include src="language_list.js"></include>
<include src="language_options.js"></include>
<include src="manage_profile_overlay.js"></include>
<include src="media_gallery_list.js"></include>
<include src="media_gallery_manager_overlay.js"></include>
<include src="media_galleries_list.js"></include>
<include src="media_galleries_manager_overlay.js"></include>
<include src="options_focus_manager.js"></include>
<include src="password_manager.js"></include>
<include src="password_manager_list.js"></include>
......
......@@ -2,11 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ui/webui/options2/media_gallery_handler.h"
#include "chrome/browser/ui/webui/options2/media_galleries_handler.h"
#include "base/bind.h"
#include "chrome/browser/media_gallery/media_gallery_registry.h"
#include "chrome/browser/media_gallery/media_gallery_registry_factory.h"
#include "chrome/browser/media_gallery/media_galleries_preferences.h"
#include "chrome/browser/media_gallery/media_galleries_preferences_factory.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/chrome_select_file_policy.h"
......@@ -20,13 +20,13 @@
namespace options2 {
MediaGalleryHandler::MediaGalleryHandler() {
MediaGalleriesHandler::MediaGalleriesHandler() {
}
MediaGalleryHandler::~MediaGalleryHandler() {
MediaGalleriesHandler::~MediaGalleriesHandler() {
}
void MediaGalleryHandler::GetLocalizedValues(DictionaryValue* values) {
void MediaGalleriesHandler::GetLocalizedValues(DictionaryValue* values) {
DCHECK(values);
static OptionsStringResource resources[] = {
......@@ -40,42 +40,42 @@ void MediaGalleryHandler::GetLocalizedValues(DictionaryValue* values) {
IDS_MEDIA_GALLERY_MANAGE_TITLE);
}
void MediaGalleryHandler::InitializeHandler() {
if (!MediaGalleryRegistry::UserInteractionIsEnabled())
void MediaGalleriesHandler::InitializeHandler() {
if (!MediaGalleriesPreferences::UserInteractionIsEnabled())
return;
Profile* profile = Profile::FromWebUI(web_ui());
pref_change_registrar_.Init(profile->GetPrefs());
pref_change_registrar_.Add(prefs::kMediaGalleryRememberedGalleries, this);
pref_change_registrar_.Add(prefs::kMediaGalleriesRememberedGalleries, this);
}
void MediaGalleryHandler::InitializePage() {
if (!MediaGalleryRegistry::UserInteractionIsEnabled())
void MediaGalleriesHandler::InitializePage() {
if (!MediaGalleriesPreferences::UserInteractionIsEnabled())
return;
OnGalleriesChanged();
}
void MediaGalleryHandler::RegisterMessages() {
void MediaGalleriesHandler::RegisterMessages() {
web_ui()->RegisterMessageCallback(
"addNewGallery",
base::Bind(&MediaGalleryHandler::HandleAddNewGallery,
base::Bind(&MediaGalleriesHandler::HandleAddNewGallery,
base::Unretained(this)));
web_ui()->RegisterMessageCallback(
"forgetGallery",
base::Bind(&MediaGalleryHandler::HandleForgetGallery,
base::Bind(&MediaGalleriesHandler::HandleForgetGallery,
base::Unretained(this)));
}
void MediaGalleryHandler::OnGalleriesChanged() {
void MediaGalleriesHandler::OnGalleriesChanged() {
Profile* profile = Profile::FromWebUI(web_ui());
const ListValue* list = profile->GetPrefs()->GetList(
prefs::kMediaGalleryRememberedGalleries);
prefs::kMediaGalleriesRememberedGalleries);
web_ui()->CallJavascriptFunction(
"options.MediaGalleryManager.setAvailableMediaGalleries", *list);
"options.MediaGalleriesManager.setAvailableMediaGalleries", *list);
}
void MediaGalleryHandler::HandleAddNewGallery(const base::ListValue* args) {
void MediaGalleriesHandler::HandleAddNewGallery(const base::ListValue* args) {
SelectFileDialog* dialog = SelectFileDialog::Create(
this,
new ChromeSelectFilePolicy(web_ui()->GetWebContents()));
......@@ -89,29 +89,31 @@ void MediaGalleryHandler::HandleAddNewGallery(const base::ListValue* args) {
NULL);
}
void MediaGalleryHandler::HandleForgetGallery(const base::ListValue* args) {
void MediaGalleriesHandler::HandleForgetGallery(const base::ListValue* args) {
// TODO(estade): use uint64.
int id;
CHECK(ExtractIntegerValue(args, &id));
MediaGalleryRegistry* registry =
MediaGalleryRegistryFactory::GetForProfile(Profile::FromWebUI(web_ui()));
registry->ForgetGalleryById(id);
MediaGalleriesPreferences* prefs =
MediaGalleriesPreferencesFactory::GetForProfile(
Profile::FromWebUI(web_ui()));
prefs->ForgetGalleryById(id);
}
void MediaGalleryHandler::FileSelected(
void MediaGalleriesHandler::FileSelected(
const FilePath& path, int index, void* params) {
MediaGalleryRegistry* registry =
MediaGalleryRegistryFactory::GetForProfile(Profile::FromWebUI(web_ui()));
registry->AddGalleryByPath(path);
MediaGalleriesPreferences* prefs =
MediaGalleriesPreferencesFactory::GetForProfile(
Profile::FromWebUI(web_ui()));
prefs->AddGalleryByPath(path);
}
void MediaGalleryHandler::Observe(
void MediaGalleriesHandler::Observe(
int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
if (type == chrome::NOTIFICATION_PREF_CHANGED &&
*content::Details<std::string>(details).ptr() ==
prefs::kMediaGalleryRememberedGalleries) {
prefs::kMediaGalleriesRememberedGalleries) {
OnGalleriesChanged();
} else {
NOTREACHED();
......
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS2_MEDIA_GALLERY_HANDLER_H_
#define CHROME_BROWSER_UI_WEBUI_OPTIONS2_MEDIA_GALLERY_HANDLER_H_
#ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS2_MEDIA_GALLERIES_HANDLER_H_
#define CHROME_BROWSER_UI_WEBUI_OPTIONS2_MEDIA_GALLERIES_HANDLER_H_
#include "chrome/browser/prefs/pref_change_registrar.h"
#include "chrome/browser/ui/select_file_dialog.h"
......@@ -13,11 +13,11 @@
namespace options2 {
// Handles messages related to adding or removing media galleries.
class MediaGalleryHandler : public OptionsPageUIHandler,
class MediaGalleriesHandler : public OptionsPageUIHandler,
public SelectFileDialog::Listener {
public:
MediaGalleryHandler();
virtual ~MediaGalleryHandler();
MediaGalleriesHandler();
virtual ~MediaGalleriesHandler();
// OptionsPageUIHandler implementation.
virtual void GetLocalizedValues(base::DictionaryValue* values) OVERRIDE;
......@@ -46,9 +46,9 @@ class MediaGalleryHandler : public OptionsPageUIHandler,
PrefChangeRegistrar pref_change_registrar_;
DISALLOW_COPY_AND_ASSIGN(MediaGalleryHandler);
DISALLOW_COPY_AND_ASSIGN(MediaGalleriesHandler);
};
} // namespace options2
#endif // CHROME_BROWSER_UI_WEBUI_OPTIONS2_MEDIA_GALLERY_HANDLER_H_
#endif // CHROME_BROWSER_UI_WEBUI_OPTIONS2_MEDIA_GALLERIES_HANDLER_H_
......@@ -35,7 +35,7 @@
#include "chrome/browser/ui/webui/options2/import_data_handler.h"
#include "chrome/browser/ui/webui/options2/language_options_handler.h"
#include "chrome/browser/ui/webui/options2/manage_profile_handler.h"
#include "chrome/browser/ui/webui/options2/media_gallery_handler.h"
#include "chrome/browser/ui/webui/options2/media_galleries_handler.h"
#include "chrome/browser/ui/webui/options2/options_sync_setup_handler.h"
#include "chrome/browser/ui/webui/options2/password_manager_handler.h"
#include "chrome/browser/ui/webui/options2/search_engine_manager_handler.h"
......@@ -235,7 +235,7 @@ OptionsUI::OptionsUI(content::WebUI* web_ui)
AddOptionsPageUIHandler(localized_strings, new CookiesViewHandler());
AddOptionsPageUIHandler(localized_strings, new FontSettingsHandler());
AddOptionsPageUIHandler(localized_strings, new HomePageOverlayHandler());
AddOptionsPageUIHandler(localized_strings, new MediaGalleryHandler());
AddOptionsPageUIHandler(localized_strings, new MediaGalleriesHandler());
AddOptionsPageUIHandler(localized_strings, new WebIntentsSettingsHandler());
#if defined(OS_CHROMEOS)
AddOptionsPageUIHandler(localized_strings,
......
......@@ -1412,14 +1412,14 @@
'browser/media_gallery/media_device_notifications_window_win.h',
'browser/media_gallery/media_file_system_registry.cc',
'browser/media_gallery/media_file_system_registry.h',
'browser/media_gallery/media_galleries_preferences.cc',
'browser/media_gallery/media_galleries_preferences.h',
'browser/media_gallery/media_galleries_preferences_factory.cc',
'browser/media_gallery/media_galleries_preferences_factory.h',
'browser/media_gallery/media_gallery_database.cc',
'browser/media_gallery/media_gallery_database.h',
'browser/media_gallery/media_gallery_database_types.cc',
'browser/media_gallery/media_gallery_database_types.h',
'browser/media_gallery/media_gallery_registry.cc',
'browser/media_gallery/media_gallery_registry.h',
'browser/media_gallery/media_gallery_registry_factory.cc',
'browser/media_gallery/media_gallery_registry_factory.h',
'browser/memory_details.cc',
'browser/memory_details.h',
'browser/memory_details_android.cc',
......@@ -4147,8 +4147,8 @@
'browser/ui/webui/options2/language_options_handler_common.h',
'browser/ui/webui/options2/manage_profile_handler.cc',
'browser/ui/webui/options2/manage_profile_handler.h',
'browser/ui/webui/options2/media_gallery_handler.cc',
'browser/ui/webui/options2/media_gallery_handler.h',
'browser/ui/webui/options2/media_galleries_handler.cc',
'browser/ui/webui/options2/media_galleries_handler.h',
'browser/ui/webui/options2/options_sync_setup_handler.cc',
'browser/ui/webui/options2/options_sync_setup_handler.h',
'browser/ui/webui/options2/options_ui.cc',
......
......@@ -1941,12 +1941,12 @@ const char kComponentUpdaterState[] = "component_updater.state";
const char kWebIntentsEnabled[] = "webintents.enabled";
// The next media gallery ID to assign.
const char kMediaGalleryUniqueId[] = "media_gallery.gallery_id";
const char kMediaGalleriesUniqueId[] = "media_galleries.gallery_id";
// A list of dictionaries, where each dictionary represents a known media
// gallery.
const char kMediaGalleryRememberedGalleries[] =
"media_gallery.remembered_galleries";
const char kMediaGalleriesRememberedGalleries[] =
"media_galleries.remembered_galleries";
#if defined(USE_AURA)
// String value corresponding to ash::Shell::ShelfAlignment.
......
......@@ -717,8 +717,8 @@ extern const char kComponentUpdaterState[];
extern const char kWebIntentsEnabled[];
extern const char kMediaGalleryUniqueId[];
extern const char kMediaGalleryRememberedGalleries[];
extern const char kMediaGalleriesUniqueId[];
extern const char kMediaGalleriesRememberedGalleries[];
#if defined(USE_AURA)
extern const char kShelfAlignment[];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment