| 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_actions_api.h
" | 5 #include "chrome/browser/extensions/api/extension_action/extension_actions_api.h
" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| 11 #include "chrome/browser/extensions/api/extension_action/extension_page_actions_
api_constants.h" | 11 #include "chrome/browser/extensions/api/extension_action/extension_page_actions_
api_constants.h" |
| 12 #include "chrome/browser/extensions/extension_service.h" | 12 #include "chrome/browser/extensions/extension_service.h" |
| 13 #include "chrome/browser/extensions/extension_tab_helper.h" | 13 #include "chrome/browser/extensions/extension_tab_helper.h" |
| 14 #include "chrome/browser/extensions/extension_tab_util.h" | 14 #include "chrome/browser/extensions/extension_tab_util.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 16 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 16 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 17 #include "chrome/common/chrome_notification_types.h" | 17 #include "chrome/common/chrome_notification_types.h" |
| 18 #include "chrome/common/extensions/extension.h" | 18 #include "chrome/common/extensions/extension.h" |
| 19 #include "chrome/common/extensions/extension_action.h" | 19 #include "chrome/common/extensions/extension_action.h" |
| 20 #include "chrome/common/extensions/extension_error_utils.h" | 20 #include "chrome/common/extensions/extension_error_utils.h" |
| 21 #include "chrome/common/render_messages.h" | 21 #include "chrome/common/render_messages.h" |
| 22 #include "content/public/browser/navigation_entry.h" | 22 #include "content/public/browser/navigation_entry.h" |
| 23 #include "content/public/browser/notification_service.h" | 23 #include "content/public/browser/notification_service.h" |
| 24 | 24 |
| 25 namespace { | 25 namespace { |
| 26 | 26 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 } | 77 } |
| 78 } | 78 } |
| 79 break; | 79 break; |
| 80 } | 80 } |
| 81 | 81 |
| 82 default: | 82 default: |
| 83 EXTENSION_FUNCTION_VALIDATE(false); | 83 EXTENSION_FUNCTION_VALIDATE(false); |
| 84 } | 84 } |
| 85 } | 85 } |
| 86 | 86 |
| 87 // Find the TabContentsWrapper that contains this tab id if one is required. | 87 // Find the TabContents that contains this tab id if one is required. |
| 88 if (tab_id_ == ExtensionAction::kDefaultTabId) { | 88 if (tab_id_ == ExtensionAction::kDefaultTabId) { |
| 89 EXTENSION_FUNCTION_VALIDATE(GetExtension()->browser_action()); | 89 EXTENSION_FUNCTION_VALIDATE(GetExtension()->browser_action()); |
| 90 } else { | 90 } else { |
| 91 ExtensionTabUtil::GetTabById( | 91 ExtensionTabUtil::GetTabById( |
| 92 tab_id_, profile(), include_incognito(), NULL, NULL, &contents_, NULL); | 92 tab_id_, profile(), include_incognito(), NULL, NULL, &contents_, NULL); |
| 93 if (!contents_) { | 93 if (!contents_) { |
| 94 error_ = ExtensionErrorUtils::FormatErrorMessage( | 94 error_ = ExtensionErrorUtils::FormatErrorMessage( |
| 95 kNoTabError, base::IntToString(tab_id_)); | 95 kNoTabError, base::IntToString(tab_id_)); |
| 96 return false; | 96 return false; |
| 97 } | 97 } |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 bool ExtensionActionGetBadgeBackgroundColorFunction::RunExtensionAction() { | 284 bool ExtensionActionGetBadgeBackgroundColorFunction::RunExtensionAction() { |
| 285 ListValue* list = new ListValue(); | 285 ListValue* list = new ListValue(); |
| 286 SkColor color = extension_action_->GetBadgeBackgroundColor(tab_id_); | 286 SkColor color = extension_action_->GetBadgeBackgroundColor(tab_id_); |
| 287 list->Append(Value::CreateIntegerValue(SkColorGetR(color))); | 287 list->Append(Value::CreateIntegerValue(SkColorGetR(color))); |
| 288 list->Append(Value::CreateIntegerValue(SkColorGetG(color))); | 288 list->Append(Value::CreateIntegerValue(SkColorGetG(color))); |
| 289 list->Append(Value::CreateIntegerValue(SkColorGetB(color))); | 289 list->Append(Value::CreateIntegerValue(SkColorGetB(color))); |
| 290 list->Append(Value::CreateIntegerValue(SkColorGetA(color))); | 290 list->Append(Value::CreateIntegerValue(SkColorGetA(color))); |
| 291 result_.reset(list); | 291 result_.reset(list); |
| 292 return true; | 292 return true; |
| 293 } | 293 } |
| OLD | NEW |