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

Side by Side Diff: chrome/browser/extensions/extension_action_storage_manager.cc

Issue 1549233002: Convert Pass()→std::move() in //chrome/browser/extensions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 12 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/extension_action_storage_manager.h" 5 #include "chrome/browser/extensions/extension_action_storage_manager.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <utility>
8 9
9 #include "base/base64.h" 10 #include "base/base64.h"
10 #include "base/bind.h" 11 #include "base/bind.h"
11 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
12 #include "base/strings/string_number_conversions.h" 13 #include "base/strings/string_number_conversions.h"
13 #include "base/values.h" 14 #include "base/values.h"
14 #include "chrome/browser/extensions/extension_action.h" 15 #include "chrome/browser/extensions/extension_action.h"
15 #include "chrome/browser/extensions/extension_action_manager.h" 16 #include "chrome/browser/extensions/extension_action_manager.h"
16 #include "extensions/browser/extension_registry.h" 17 #include "extensions/browser/extension_registry.h"
17 #include "extensions/browser/extension_system.h" 18 #include "extensions/browser/extension_system.h"
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 gfx::ImageSkia icon = 178 gfx::ImageSkia icon =
178 action->GetExplicitlySetIcon(kDefaultTabId).AsImageSkia(); 179 action->GetExplicitlySetIcon(kDefaultTabId).AsImageSkia();
179 if (!icon.isNull()) { 180 if (!icon.isNull()) {
180 scoped_ptr<base::DictionaryValue> icon_value(new base::DictionaryValue()); 181 scoped_ptr<base::DictionaryValue> icon_value(new base::DictionaryValue());
181 std::vector<gfx::ImageSkiaRep> image_reps = icon.image_reps(); 182 std::vector<gfx::ImageSkiaRep> image_reps = icon.image_reps();
182 for (const gfx::ImageSkiaRep& rep : image_reps) { 183 for (const gfx::ImageSkiaRep& rep : image_reps) {
183 int size = static_cast<int>(rep.scale() * icon.width()); 184 int size = static_cast<int>(rep.scale() * icon.width());
184 std::string size_string = base::IntToString(size); 185 std::string size_string = base::IntToString(size);
185 icon_value->SetString(size_string, BitmapToString(rep.sk_bitmap())); 186 icon_value->SetString(size_string, BitmapToString(rep.sk_bitmap()));
186 } 187 }
187 dict->Set(kIconStorageKey, icon_value.Pass()); 188 dict->Set(kIconStorageKey, std::move(icon_value));
188 } 189 }
189 return dict; 190 return dict;
190 } 191 }
191 192
192 } // namespace 193 } // namespace
193 194
194 ExtensionActionStorageManager::ExtensionActionStorageManager( 195 ExtensionActionStorageManager::ExtensionActionStorageManager(
195 content::BrowserContext* context) 196 content::BrowserContext* context)
196 : browser_context_(context), 197 : browser_context_(context),
197 extension_action_observer_(this), 198 extension_action_observer_(this),
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 extension_action_observer_.RemoveAll(); 240 extension_action_observer_.RemoveAll();
240 } 241 }
241 242
242 void ExtensionActionStorageManager::WriteToStorage( 243 void ExtensionActionStorageManager::WriteToStorage(
243 ExtensionAction* extension_action) { 244 ExtensionAction* extension_action) {
244 StateStore* store = GetStateStore(); 245 StateStore* store = GetStateStore();
245 if (store) { 246 if (store) {
246 scoped_ptr<base::DictionaryValue> defaults = 247 scoped_ptr<base::DictionaryValue> defaults =
247 DefaultsToValue(extension_action); 248 DefaultsToValue(extension_action);
248 store->SetExtensionValue(extension_action->extension_id(), 249 store->SetExtensionValue(extension_action->extension_id(),
249 kBrowserActionStorageKey, 250 kBrowserActionStorageKey, std::move(defaults));
250 defaults.Pass());
251 } 251 }
252 } 252 }
253 253
254 void ExtensionActionStorageManager::ReadFromStorage( 254 void ExtensionActionStorageManager::ReadFromStorage(
255 const std::string& extension_id, scoped_ptr<base::Value> value) { 255 const std::string& extension_id, scoped_ptr<base::Value> value) {
256 const Extension* extension = ExtensionRegistry::Get(browser_context_)-> 256 const Extension* extension = ExtensionRegistry::Get(browser_context_)->
257 enabled_extensions().GetByID(extension_id); 257 enabled_extensions().GetByID(extension_id);
258 if (!extension) 258 if (!extension)
259 return; 259 return;
260 260
(...skipping 12 matching lines...) Expand all
273 return; 273 return;
274 274
275 SetDefaultsFromValue(dict, browser_action); 275 SetDefaultsFromValue(dict, browser_action);
276 } 276 }
277 277
278 StateStore* ExtensionActionStorageManager::GetStateStore() { 278 StateStore* ExtensionActionStorageManager::GetStateStore() {
279 return ExtensionSystem::Get(browser_context_)->state_store(); 279 return ExtensionSystem::Get(browser_context_)->state_store();
280 } 280 }
281 281
282 } // namespace extensions 282 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_action_manager.cc ('k') | chrome/browser/extensions/extension_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698