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

Side by Side Diff: chrome/browser/extensions/extension_prefs.cc

Issue 15051010: Move [Get|Set]UpdateURLData from ExtensionPrefs to ExtensionAPI (aka Module) (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/extension_prefs.h" 5 #include "chrome/browser/extensions/extension_prefs.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/prefs/pref_notifier.h" 8 #include "base/prefs/pref_notifier.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 // purchased apps. 129 // purchased apps.
130 const char kWebStoreLogin[] = "extensions.webstore_login"; 130 const char kWebStoreLogin[] = "extensions.webstore_login";
131 131
132 // A preference set by the the NTP to persist the desired launch container type 132 // A preference set by the the NTP to persist the desired launch container type
133 // used for apps. 133 // used for apps.
134 const char kPrefLaunchType[] = "launchType"; 134 const char kPrefLaunchType[] = "launchType";
135 135
136 // A preference specifying if the user dragged the app on the NTP. 136 // A preference specifying if the user dragged the app on the NTP.
137 const char kPrefUserDraggedApp[] = "user_dragged_app_ntp"; 137 const char kPrefUserDraggedApp[] = "user_dragged_app_ntp";
138 138
139 // A preference for storing extra data sent in update checks for an extension.
140 const char kUpdateUrlData[] = "update_url_data";
141
142 // Preferences that hold which permissions the user has granted the extension. 139 // Preferences that hold which permissions the user has granted the extension.
143 // We explicitly keep track of these so that extensions can contain unknown 140 // We explicitly keep track of these so that extensions can contain unknown
144 // permissions, for backwards compatibility reasons, and we can still prompt 141 // permissions, for backwards compatibility reasons, and we can still prompt
145 // the user to accept them once recognized. We store the active permission 142 // the user to accept them once recognized. We store the active permission
146 // permissions because they may differ from those defined in the manifest. 143 // permissions because they may differ from those defined in the manifest.
147 const char kPrefActivePermissions[] = "active_permissions"; 144 const char kPrefActivePermissions[] = "active_permissions";
148 const char kPrefGrantedPermissions[] = "granted_permissions"; 145 const char kPrefGrantedPermissions[] = "granted_permissions";
149 146
150 // The preference names for PermissionSet values. 147 // The preference names for PermissionSet values.
151 const char kPrefAPIs[] = "api"; 148 const char kPrefAPIs[] = "api";
(...skipping 1431 matching lines...) Expand 10 before | Expand all | Expand 10 after
1583 1580
1584 bool ExtensionPrefs::WasAppDraggedByUser(const std::string& extension_id) { 1581 bool ExtensionPrefs::WasAppDraggedByUser(const std::string& extension_id) {
1585 return ReadPrefAsBooleanAndReturn(extension_id, kPrefUserDraggedApp); 1582 return ReadPrefAsBooleanAndReturn(extension_id, kPrefUserDraggedApp);
1586 } 1583 }
1587 1584
1588 void ExtensionPrefs::SetAppDraggedByUser(const std::string& extension_id) { 1585 void ExtensionPrefs::SetAppDraggedByUser(const std::string& extension_id) {
1589 UpdateExtensionPref(extension_id, kPrefUserDraggedApp, 1586 UpdateExtensionPref(extension_id, kPrefUserDraggedApp,
1590 Value::CreateBooleanValue(true)); 1587 Value::CreateBooleanValue(true));
1591 } 1588 }
1592 1589
1593 void ExtensionPrefs::SetUpdateUrlData(const std::string& extension_id,
1594 const std::string& data) {
1595 UpdateExtensionPref(extension_id, kUpdateUrlData,
1596 Value::CreateStringValue(data));
1597 }
1598
1599 std::string ExtensionPrefs::GetUpdateUrlData(const std::string& extension_id) {
1600 const DictionaryValue* dictionary = GetExtensionPref(extension_id);
1601 if (!dictionary)
1602 return std::string();
1603
1604 std::string data;
1605 dictionary->GetString(kUpdateUrlData, &data);
1606 return data;
1607 }
1608
1609 void ExtensionPrefs::OnContentSettingChanged( 1590 void ExtensionPrefs::OnContentSettingChanged(
1610 const std::string& extension_id, 1591 const std::string& extension_id,
1611 bool incognito) { 1592 bool incognito) {
1612 if (incognito) { 1593 if (incognito) {
1613 UpdateExtensionPref( 1594 UpdateExtensionPref(
1614 extension_id, kPrefIncognitoContentSettings, 1595 extension_id, kPrefIncognitoContentSettings,
1615 content_settings_store_->GetSettingsForExtension( 1596 content_settings_store_->GetSettingsForExtension(
1616 extension_id, kExtensionPrefsScopeIncognitoPersistent)); 1597 extension_id, kExtensionPrefsScopeIncognitoPersistent));
1617 } else { 1598 } else {
1618 UpdateExtensionPref( 1599 UpdateExtensionPref(
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
2160 is_enabled = initial_state == Extension::ENABLED; 2141 is_enabled = initial_state == Extension::ENABLED;
2161 } 2142 }
2162 2143
2163 extension_pref_value_map_->RegisterExtension(extension_id, install_time, 2144 extension_pref_value_map_->RegisterExtension(extension_id, install_time,
2164 is_enabled); 2145 is_enabled);
2165 content_settings_store_->RegisterExtension(extension_id, install_time, 2146 content_settings_store_->RegisterExtension(extension_id, install_time,
2166 is_enabled); 2147 is_enabled);
2167 } 2148 }
2168 2149
2169 } // namespace extensions 2150 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698