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

Side by Side Diff: chrome/common/extensions/api/extension_action/script_badge_handler.cc

Issue 11786003: Move Icons out of Extension class (Closed) Base URL: http://git.chromium.org/chromium/src.git@dc_unref_browser_action
Patch Set: Created 7 years, 10 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 #include "chrome/common/extensions/api/extension_action/script_badge_handler.h" 5 #include "chrome/common/extensions/api/extension_action/script_badge_handler.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/common/extensions/api/icons/icons_handler.h"
10 #include "chrome/common/extensions/extension.h" 11 #include "chrome/common/extensions/extension.h"
11 #include "chrome/common/extensions/extension_constants.h" 12 #include "chrome/common/extensions/extension_constants.h"
12 #include "chrome/common/extensions/extension_manifest_constants.h" 13 #include "chrome/common/extensions/extension_manifest_constants.h"
13 #include "chrome/common/extensions/feature_switch.h" 14 #include "chrome/common/extensions/feature_switch.h"
14 #include "chrome/common/extensions/manifest_handler_helpers.h" 15 #include "chrome/common/extensions/manifest_handler_helpers.h"
15 16
16 namespace errors = extension_manifest_errors; 17 namespace errors = extension_manifest_errors;
17 18
18 namespace extensions { 19 namespace extensions {
19 20
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 SetActionInfoDefaults(extension, action_info.get()); 78 SetActionInfoDefaults(extension, action_info.get());
78 ActionInfo::SetScriptBadgeInfo(extension, action_info.release()); 79 ActionInfo::SetScriptBadgeInfo(extension, action_info.release());
79 return true; 80 return true;
80 } 81 }
81 82
82 void ScriptBadgeHandler::SetActionInfoDefaults(const Extension* extension, 83 void ScriptBadgeHandler::SetActionInfoDefaults(const Extension* extension,
83 ActionInfo* info) { 84 ActionInfo* info) {
84 info->default_title = extension->name(); 85 info->default_title = extension->name();
85 info->default_icon.Clear(); 86 info->default_icon.Clear();
86 for (size_t i = 0; i < extension_misc::kNumScriptBadgeIconSizes; ++i) { 87 for (size_t i = 0; i < extension_misc::kNumScriptBadgeIconSizes; ++i) {
87 std::string path = extension->icons().Get( 88 std::string path = IconsInfo::GetIcons(extension).Get(
88 extension_misc::kScriptBadgeIconSizes[i], 89 extension_misc::kScriptBadgeIconSizes[i],
89 ExtensionIconSet::MATCH_BIGGER); 90 ExtensionIconSet::MATCH_BIGGER);
90 if (!path.empty()) { 91 if (!path.empty()) {
91 info->default_icon.Add( 92 info->default_icon.Add(
92 extension_misc::kScriptBadgeIconSizes[i], path); 93 extension_misc::kScriptBadgeIconSizes[i], path);
93 } 94 }
94 } 95 }
95 } 96 }
96 97
97 } // namespace extensions 98 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698