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

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

Issue 10675007: Move each permission classes to its own files in extensions/permissions (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase again Created 8 years, 5 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 // Font Settings Extension API implementation. 5 // Font Settings Extension API implementation.
6 6
7 #include "chrome/browser/extensions/extension_font_settings_api.h" 7 #include "chrome/browser/extensions/extension_font_settings_api.h"
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 12 matching lines...) Expand all
23 #include "chrome/common/pref_names.h" 23 #include "chrome/common/pref_names.h"
24 #include "content/public/browser/font_list_async.h" 24 #include "content/public/browser/font_list_async.h"
25 #include "content/public/browser/notification_details.h" 25 #include "content/public/browser/notification_details.h"
26 #include "content/public/browser/notification_source.h" 26 #include "content/public/browser/notification_source.h"
27 27
28 #if defined(OS_WIN) 28 #if defined(OS_WIN)
29 #include "ui/gfx/font.h" 29 #include "ui/gfx/font.h"
30 #include "ui/gfx/platform_font_win.h" 30 #include "ui/gfx/platform_font_win.h"
31 #endif 31 #endif
32 32
33 using extensions::APIPermission;
34
33 namespace fonts = extensions::api::experimental_font_settings; 35 namespace fonts = extensions::api::experimental_font_settings;
34 36
35 namespace { 37 namespace {
36 38
37 const char kFontNameKey[] = "fontName"; 39 const char kFontNameKey[] = "fontName";
38 const char kGenericFamilyKey[] = "genericFamily"; 40 const char kGenericFamilyKey[] = "genericFamily";
39 const char kLevelOfControlKey[] = "levelOfControl"; 41 const char kLevelOfControlKey[] = "levelOfControl";
40 const char kLocalizedNameKey[] = "localizedName"; 42 const char kLocalizedNameKey[] = "localizedName";
41 const char kPixelSizeKey[] = "pixelSize"; 43 const char kPixelSizeKey[] = "pixelSize";
42 const char kScriptKey[] = "script"; 44 const char kScriptKey[] = "script";
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 DictionaryValue* dict = new DictionaryValue(); 205 DictionaryValue* dict = new DictionaryValue();
204 args.Append(dict); 206 args.Append(dict);
205 dict->SetString(kFontNameKey, font_name); 207 dict->SetString(kFontNameKey, font_name);
206 dict->SetString(kGenericFamilyKey, generic_family); 208 dict->SetString(kGenericFamilyKey, generic_family);
207 dict->SetString(kScriptKey, script); 209 dict->SetString(kScriptKey, script);
208 210
209 extension_preference_helpers::DispatchEventToExtensions( 211 extension_preference_helpers::DispatchEventToExtensions(
210 profile_, 212 profile_,
211 kOnFontChanged, 213 kOnFontChanged,
212 &args, 214 &args,
213 ExtensionAPIPermission::kExperimental, 215 APIPermission::kExperimental,
214 incognito, 216 incognito,
215 pref_name); 217 pref_name);
216 } 218 }
217 219
218 void ExtensionFontSettingsEventRouter::OnFontPrefChanged( 220 void ExtensionFontSettingsEventRouter::OnFontPrefChanged(
219 PrefService* pref_service, 221 PrefService* pref_service,
220 const std::string& pref_name, 222 const std::string& pref_name,
221 const std::string& event_name, 223 const std::string& event_name,
222 const std::string& key, 224 const std::string& key,
223 bool incognito) { 225 bool incognito) {
224 const PrefService::Preference* pref = pref_service->FindPreference( 226 const PrefService::Preference* pref = pref_service->FindPreference(
225 pref_name.c_str()); 227 pref_name.c_str());
226 CHECK(pref); 228 CHECK(pref);
227 229
228 ListValue args; 230 ListValue args;
229 DictionaryValue* dict = new DictionaryValue(); 231 DictionaryValue* dict = new DictionaryValue();
230 args.Append(dict); 232 args.Append(dict);
231 dict->Set(key, pref->GetValue()->DeepCopy()); 233 dict->Set(key, pref->GetValue()->DeepCopy());
232 234
233 extension_preference_helpers::DispatchEventToExtensions( 235 extension_preference_helpers::DispatchEventToExtensions(
234 profile_, 236 profile_,
235 event_name, 237 event_name,
236 &args, 238 &args,
237 ExtensionAPIPermission::kExperimental, 239 APIPermission::kExperimental,
238 incognito, 240 incognito,
239 pref_name); 241 pref_name);
240 } 242 }
241 243
242 bool ClearFontFunction::RunImpl() { 244 bool ClearFontFunction::RunImpl() {
243 if (profile_->IsOffTheRecord()) { 245 if (profile_->IsOffTheRecord()) {
244 error_ = kSetFromIncognitoError; 246 error_ = kSetFromIncognitoError;
245 return false; 247 return false;
246 } 248 }
247 249
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 return kPixelSizeKey; 471 return kPixelSizeKey;
470 } 472 }
471 473
472 const char* SetMinimumFontSizeFunction::GetPrefName() { 474 const char* SetMinimumFontSizeFunction::GetPrefName() {
473 return prefs::kWebKitMinimumFontSize; 475 return prefs::kWebKitMinimumFontSize;
474 } 476 }
475 477
476 const char* SetMinimumFontSizeFunction::GetKey() { 478 const char* SetMinimumFontSizeFunction::GetKey() {
477 return kPixelSizeKey; 479 return kPixelSizeKey;
478 } 480 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/convert_web_app_browsertest.cc ('k') | chrome/browser/extensions/extension_info_map.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698