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

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

Issue 10694106: Added support for multiple parameters to Extension API callbacks. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Synced. 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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 const bool kIncognito = false; 287 const bool kIncognito = false;
288 std::string level_of_control = 288 std::string level_of_control =
289 extension_preference_helpers::GetLevelOfControl(profile_, 289 extension_preference_helpers::GetLevelOfControl(profile_,
290 extension_id(), 290 extension_id(),
291 pref_path, 291 pref_path,
292 kIncognito); 292 kIncognito);
293 293
294 DictionaryValue* result = new DictionaryValue(); 294 DictionaryValue* result = new DictionaryValue();
295 result->SetString(kFontNameKey, font_name); 295 result->SetString(kFontNameKey, font_name);
296 result->SetString(kLevelOfControlKey, level_of_control); 296 result->SetString(kLevelOfControlKey, level_of_control);
297 result_.reset(result); 297 SetResult(result);
298 return true; 298 return true;
299 } 299 }
300 300
301 bool SetFontFunction::RunImpl() { 301 bool SetFontFunction::RunImpl() {
302 if (profile_->IsOffTheRecord()) { 302 if (profile_->IsOffTheRecord()) {
303 error_ = kSetFromIncognitoError; 303 error_ = kSetFromIncognitoError;
304 return false; 304 return false;
305 } 305 }
306 306
307 scoped_ptr<fonts::SetFont::Params> params( 307 scoped_ptr<fonts::SetFont::Params> params(
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 NOTREACHED(); 355 NOTREACHED();
356 return false; 356 return false;
357 } 357 }
358 358
359 DictionaryValue* font_name = new DictionaryValue(); 359 DictionaryValue* font_name = new DictionaryValue();
360 font_name->Set(kFontNameKey, Value::CreateStringValue(name)); 360 font_name->Set(kFontNameKey, Value::CreateStringValue(name));
361 font_name->Set(kLocalizedNameKey, Value::CreateStringValue(localized_name)); 361 font_name->Set(kLocalizedNameKey, Value::CreateStringValue(localized_name));
362 result->Append(font_name); 362 result->Append(font_name);
363 } 363 }
364 364
365 result_.reset(result.release()); 365 SetResult(result.release());
366 return true; 366 return true;
367 } 367 }
368 368
369 bool ClearFontPrefExtensionFunction::RunImpl() { 369 bool ClearFontPrefExtensionFunction::RunImpl() {
370 if (profile_->IsOffTheRecord()) { 370 if (profile_->IsOffTheRecord()) {
371 error_ = kSetFromIncognitoError; 371 error_ = kSetFromIncognitoError;
372 return false; 372 return false;
373 } 373 }
374 374
375 extensions::ExtensionPrefs* prefs = 375 extensions::ExtensionPrefs* prefs =
(...skipping 15 matching lines...) Expand all
391 391
392 std::string level_of_control = 392 std::string level_of_control =
393 extension_preference_helpers::GetLevelOfControl(profile_, 393 extension_preference_helpers::GetLevelOfControl(profile_,
394 extension_id(), 394 extension_id(),
395 GetPrefName(), 395 GetPrefName(),
396 kIncognito); 396 kIncognito);
397 397
398 DictionaryValue* result = new DictionaryValue(); 398 DictionaryValue* result = new DictionaryValue();
399 result->Set(GetKey(), pref->GetValue()->DeepCopy()); 399 result->Set(GetKey(), pref->GetValue()->DeepCopy());
400 result->SetString(kLevelOfControlKey, level_of_control); 400 result->SetString(kLevelOfControlKey, level_of_control);
401 result_.reset(result); 401 SetResult(result);
402 return true; 402 return true;
403 } 403 }
404 404
405 bool SetFontPrefExtensionFunction::RunImpl() { 405 bool SetFontPrefExtensionFunction::RunImpl() {
406 if (profile_->IsOffTheRecord()) { 406 if (profile_->IsOffTheRecord()) {
407 error_ = kSetFromIncognitoError; 407 error_ = kSetFromIncognitoError;
408 return false; 408 return false;
409 } 409 }
410 410
411 DictionaryValue* details = NULL; 411 DictionaryValue* details = NULL;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 return kPixelSizeKey; 475 return kPixelSizeKey;
476 } 476 }
477 477
478 const char* SetMinimumFontSizeFunction::GetPrefName() { 478 const char* SetMinimumFontSizeFunction::GetPrefName() {
479 return prefs::kWebKitMinimumFontSize; 479 return prefs::kWebKitMinimumFontSize;
480 } 480 }
481 481
482 const char* SetMinimumFontSizeFunction::GetKey() { 482 const char* SetMinimumFontSizeFunction::GetKey() {
483 return kPixelSizeKey; 483 return kPixelSizeKey;
484 } 484 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698