| 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 "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 if (dict->GetString(kBadgeTextColorStorageKey, &str_value) && | 167 if (dict->GetString(kBadgeTextColorStorageKey, &str_value) && |
| 168 !action->HasBadgeTextColor(kDefaultTabId)) { | 168 !action->HasBadgeTextColor(kDefaultTabId)) { |
| 169 action->SetBadgeTextColor(kDefaultTabId, RawStringToSkColor(str_value)); | 169 action->SetBadgeTextColor(kDefaultTabId, RawStringToSkColor(str_value)); |
| 170 } | 170 } |
| 171 if (dict->GetInteger(kAppearanceStorageKey, &int_value) && | 171 if (dict->GetInteger(kAppearanceStorageKey, &int_value) && |
| 172 !action->HasIsVisible(kDefaultTabId)) { | 172 !action->HasIsVisible(kDefaultTabId)) { |
| 173 switch (int_value) { | 173 switch (int_value) { |
| 174 case INVISIBLE: | 174 case INVISIBLE: |
| 175 case OBSOLETE_WANTS_ATTENTION: | 175 case OBSOLETE_WANTS_ATTENTION: |
| 176 action->SetIsVisible(kDefaultTabId, false); | 176 action->SetIsVisible(kDefaultTabId, false); |
| 177 break; |
| 177 case ACTIVE: | 178 case ACTIVE: |
| 178 action->SetIsVisible(kDefaultTabId, true); | 179 action->SetIsVisible(kDefaultTabId, true); |
| 180 break; |
| 179 } | 181 } |
| 180 } | 182 } |
| 181 | 183 |
| 182 const base::DictionaryValue* icon_value = NULL; | 184 const base::DictionaryValue* icon_value = NULL; |
| 183 if (dict->GetDictionary(kIconStorageKey, &icon_value) && | 185 if (dict->GetDictionary(kIconStorageKey, &icon_value) && |
| 184 !action->HasIcon(kDefaultTabId)) { | 186 !action->HasIcon(kDefaultTabId)) { |
| 185 for (size_t i = 0; i < arraysize(kIconSizes); i++) { | 187 for (size_t i = 0; i < arraysize(kIconSizes); i++) { |
| 186 if (icon_value->GetString(kIconSizes[i].size_string, &str_value) && | 188 if (icon_value->GetString(kIconSizes[i].size_string, &str_value) && |
| 187 StringToSkBitmap(str_value, &bitmap)) { | 189 StringToSkBitmap(str_value, &bitmap)) { |
| 188 CHECK(!bitmap.isNull()); | 190 CHECK(!bitmap.isNull()); |
| (...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 913 return true; | 915 return true; |
| 914 } | 916 } |
| 915 | 917 |
| 916 bool EnablePageActionsFunction::RunSync() { | 918 bool EnablePageActionsFunction::RunSync() { |
| 917 return SetPageActionEnabled(true); | 919 return SetPageActionEnabled(true); |
| 918 } | 920 } |
| 919 | 921 |
| 920 bool DisablePageActionsFunction::RunSync() { | 922 bool DisablePageActionsFunction::RunSync() { |
| 921 return SetPageActionEnabled(false); | 923 return SetPageActionEnabled(false); |
| 922 } | 924 } |
| OLD | NEW |