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

Side by Side Diff: chrome/browser/extensions/extension_action.h

Issue 1871713002: Convert //chrome/browser/extensions from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and fix header Created 4 years, 8 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 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_ACTION_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_ACTION_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_ACTION_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_ACTION_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory>
9 #include <string> 10 #include <string>
10 #include <vector> 11 #include <vector>
11 12
12 #include "base/macros.h" 13 #include "base/macros.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/stl_util.h" 14 #include "base/stl_util.h"
15 #include "chrome/common/extensions/api/extension_action/action_info.h" 15 #include "chrome/common/extensions/api/extension_action/action_info.h"
16 #include "extensions/common/constants.h" 16 #include "extensions/common/constants.h"
17 #include "third_party/skia/include/core/SkColor.h" 17 #include "third_party/skia/include/core/SkColor.h"
18 #include "ui/gfx/image/image.h" 18 #include "ui/gfx/image/image.h"
19 19
20 class GURL; 20 class GURL;
21 21
22 namespace content { 22 namespace content {
23 class BrowserContext; 23 class BrowserContext;
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 // Determine whether or not the ExtensionAction has a value set for the given 194 // Determine whether or not the ExtensionAction has a value set for the given
195 // |tab_id| for each property. 195 // |tab_id| for each property.
196 bool HasPopupUrl(int tab_id) const; 196 bool HasPopupUrl(int tab_id) const;
197 bool HasTitle(int tab_id) const; 197 bool HasTitle(int tab_id) const;
198 bool HasBadgeText(int tab_id) const; 198 bool HasBadgeText(int tab_id) const;
199 bool HasBadgeBackgroundColor(int tab_id) const; 199 bool HasBadgeBackgroundColor(int tab_id) const;
200 bool HasBadgeTextColor(int tab_id) const; 200 bool HasBadgeTextColor(int tab_id) const;
201 bool HasIsVisible(int tab_id) const; 201 bool HasIsVisible(int tab_id) const;
202 bool HasIcon(int tab_id) const; 202 bool HasIcon(int tab_id) const;
203 203
204 void SetDefaultIconForTest(scoped_ptr<ExtensionIconSet> default_icon); 204 void SetDefaultIconForTest(std::unique_ptr<ExtensionIconSet> default_icon);
205 205
206 private: 206 private:
207 // Populates the action from the |extension| and |manifest_data|, filling in 207 // Populates the action from the |extension| and |manifest_data|, filling in
208 // any missing values (like title or icons) as possible. 208 // any missing values (like title or icons) as possible.
209 void Populate(const extensions::Extension& extension, 209 void Populate(const extensions::Extension& extension,
210 const extensions::ActionInfo& manifest_data); 210 const extensions::ActionInfo& manifest_data);
211 211
212 // Returns width of the current icon for tab_id. 212 // Returns width of the current icon for tab_id.
213 // TODO(tbarzic): The icon selection is done in ExtensionActionIconFactory. 213 // TODO(tbarzic): The icon selection is done in ExtensionActionIconFactory.
214 // We should probably move this there too. 214 // We should probably move this there too.
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 // Maps tab_id to the number of active (applied-but-not-reverted) 276 // Maps tab_id to the number of active (applied-but-not-reverted)
277 // declarativeContent.ShowPageAction actions. 277 // declarativeContent.ShowPageAction actions.
278 std::map<int, int> declarative_show_count_; 278 std::map<int, int> declarative_show_count_;
279 279
280 // declarative_icon_[tab_id][declarative_rule_priority] is a vector of icon 280 // declarative_icon_[tab_id][declarative_rule_priority] is a vector of icon
281 // images that are currently in effect 281 // images that are currently in effect
282 std::map<int, std::map<int, std::vector<gfx::Image> > > declarative_icon_; 282 std::map<int, std::map<int, std::vector<gfx::Image> > > declarative_icon_;
283 283
284 // ExtensionIconSet containing paths to bitmaps from which default icon's 284 // ExtensionIconSet containing paths to bitmaps from which default icon's
285 // image representations will be selected. 285 // image representations will be selected.
286 scoped_ptr<ExtensionIconSet> default_icon_; 286 std::unique_ptr<ExtensionIconSet> default_icon_;
287 287
288 // The default icon image, if |default_icon_| exists. 288 // The default icon image, if |default_icon_| exists.
289 // Lazily initialized via LoadDefaultIconImage(). 289 // Lazily initialized via LoadDefaultIconImage().
290 scoped_ptr<extensions::IconImage> default_icon_image_; 290 std::unique_ptr<extensions::IconImage> default_icon_image_;
291 291
292 // The lazily-initialized image for a placeholder icon, in the event that the 292 // The lazily-initialized image for a placeholder icon, in the event that the
293 // extension doesn't have its own icon. (Mutable to allow lazy init in 293 // extension doesn't have its own icon. (Mutable to allow lazy init in
294 // GetDefaultIconImage().) 294 // GetDefaultIconImage().)
295 mutable gfx::Image placeholder_icon_image_; 295 mutable gfx::Image placeholder_icon_image_;
296 296
297 // The id for the ExtensionAction, for example: "RssPageAction". This is 297 // The id for the ExtensionAction, for example: "RssPageAction". This is
298 // needed for compat with an older version of the page actions API. 298 // needed for compat with an older version of the page actions API.
299 std::string id_; 299 std::string id_;
300 300
301 DISALLOW_COPY_AND_ASSIGN(ExtensionAction); 301 DISALLOW_COPY_AND_ASSIGN(ExtensionAction);
302 }; 302 };
303 303
304 template<> 304 template<>
305 struct ExtensionAction::ValueTraits<int> { 305 struct ExtensionAction::ValueTraits<int> {
306 static int CreateEmpty() { 306 static int CreateEmpty() {
307 return -1; 307 return -1;
308 } 308 }
309 }; 309 };
310 310
311 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_ACTION_H_ 311 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_ACTION_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/event_router_forwarder_unittest.cc ('k') | chrome/browser/extensions/extension_action.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698