Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/api/extension_action/extension_action_api.h" | 5 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 246 // static | 246 // static |
| 247 void ExtensionActionAPI::SetBrowserActionVisibility( | 247 void ExtensionActionAPI::SetBrowserActionVisibility( |
| 248 ExtensionPrefs* prefs, | 248 ExtensionPrefs* prefs, |
| 249 const std::string& extension_id, | 249 const std::string& extension_id, |
| 250 bool visible) { | 250 bool visible) { |
| 251 if (GetBrowserActionVisibility(prefs, extension_id) == visible) | 251 if (GetBrowserActionVisibility(prefs, extension_id) == visible) |
| 252 return; | 252 return; |
| 253 | 253 |
| 254 prefs->UpdateExtensionPref(extension_id, | 254 prefs->UpdateExtensionPref(extension_id, |
| 255 kBrowserActionVisible, | 255 kBrowserActionVisible, |
| 256 Value::CreateBooleanValue(visible)); | 256 new base::FundamentalValue(visible)); |
| 257 content::NotificationService::current()->Notify( | 257 content::NotificationService::current()->Notify( |
| 258 chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_VISIBILITY_CHANGED, | 258 chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_VISIBILITY_CHANGED, |
| 259 content::Source<ExtensionPrefs>(prefs), | 259 content::Source<ExtensionPrefs>(prefs), |
| 260 content::Details<const std::string>(&extension_id)); | 260 content::Details<const std::string>(&extension_id)); |
| 261 } | 261 } |
| 262 | 262 |
| 263 // | 263 // |
| 264 // ExtensionActionStorageManager | 264 // ExtensionActionStorageManager |
| 265 // | 265 // |
| 266 | 266 |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 648 if (!ParseCSSColorString(color_string, &color)) | 648 if (!ParseCSSColorString(color_string, &color)) |
| 649 return false; | 649 return false; |
| 650 } | 650 } |
| 651 | 651 |
| 652 extension_action_->SetBadgeBackgroundColor(tab_id_, color); | 652 extension_action_->SetBadgeBackgroundColor(tab_id_, color); |
| 653 NotifyChange(); | 653 NotifyChange(); |
| 654 return true; | 654 return true; |
| 655 } | 655 } |
| 656 | 656 |
| 657 bool ExtensionActionGetTitleFunction::RunExtensionAction() { | 657 bool ExtensionActionGetTitleFunction::RunExtensionAction() { |
| 658 SetResult(Value::CreateStringValue(extension_action_->GetTitle(tab_id_))); | 658 SetResult(new base::StringValue(extension_action_->GetTitle(tab_id_))); |
| 659 return true; | 659 return true; |
| 660 } | 660 } |
| 661 | 661 |
| 662 bool ExtensionActionGetPopupFunction::RunExtensionAction() { | 662 bool ExtensionActionGetPopupFunction::RunExtensionAction() { |
| 663 SetResult( | 663 SetResult( |
| 664 Value::CreateStringValue(extension_action_->GetPopupUrl(tab_id_).spec())); | 664 new base::StringValue(extension_action_->GetPopupUrl(tab_id_).spec())); |
| 665 return true; | 665 return true; |
| 666 } | 666 } |
| 667 | 667 |
| 668 bool ExtensionActionGetBadgeTextFunction::RunExtensionAction() { | 668 bool ExtensionActionGetBadgeTextFunction::RunExtensionAction() { |
| 669 SetResult(Value::CreateStringValue(extension_action_->GetBadgeText(tab_id_))); | 669 SetResult(new base::StringValue(extension_action_->GetBadgeText(tab_id_))); |
| 670 return true; | 670 return true; |
| 671 } | 671 } |
| 672 | 672 |
| 673 bool ExtensionActionGetBadgeBackgroundColorFunction::RunExtensionAction() { | 673 bool ExtensionActionGetBadgeBackgroundColorFunction::RunExtensionAction() { |
| 674 base::ListValue* list = new base::ListValue(); | 674 base::ListValue* list = new base::ListValue(); |
| 675 SkColor color = extension_action_->GetBadgeBackgroundColor(tab_id_); | 675 SkColor color = extension_action_->GetBadgeBackgroundColor(tab_id_); |
| 676 list->Append(Value::CreateIntegerValue(SkColorGetR(color))); | 676 list->Append(new base::FundamentalValue((int)SkColorGetR(color))); |
|
not at google - send to devlin
2013/08/12 20:59:48
do you really need a cast here? if so it sadly nee
dhnishi (use Chromium)
2013/08/12 23:40:40
Done.
It unfortunately didn't know which Fundamen
| |
| 677 list->Append(Value::CreateIntegerValue(SkColorGetG(color))); | 677 list->Append(new base::FundamentalValue((int)SkColorGetG(color))); |
| 678 list->Append(Value::CreateIntegerValue(SkColorGetB(color))); | 678 list->Append(new base::FundamentalValue((int)SkColorGetB(color))); |
| 679 list->Append(Value::CreateIntegerValue(SkColorGetA(color))); | 679 list->Append(new base::FundamentalValue((int)SkColorGetA(color))); |
| 680 SetResult(list); | 680 SetResult(list); |
| 681 return true; | 681 return true; |
| 682 } | 682 } |
| 683 | 683 |
| 684 // | 684 // |
| 685 // ScriptBadgeGetAttentionFunction | 685 // ScriptBadgeGetAttentionFunction |
| 686 // | 686 // |
| 687 | 687 |
| 688 ScriptBadgeGetAttentionFunction::~ScriptBadgeGetAttentionFunction() {} | 688 ScriptBadgeGetAttentionFunction::~ScriptBadgeGetAttentionFunction() {} |
| 689 | 689 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 759 return true; | 759 return true; |
| 760 } | 760 } |
| 761 | 761 |
| 762 bool EnablePageActionsFunction::RunImpl() { | 762 bool EnablePageActionsFunction::RunImpl() { |
| 763 return SetPageActionEnabled(true); | 763 return SetPageActionEnabled(true); |
| 764 } | 764 } |
| 765 | 765 |
| 766 bool DisablePageActionsFunction::RunImpl() { | 766 bool DisablePageActionsFunction::RunImpl() { |
| 767 return SetPageActionEnabled(false); | 767 return SetPageActionEnabled(false); |
| 768 } | 768 } |
| OLD | NEW |