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

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

Issue 10071035: RefCounted types should not have public destructors, chrome/browser/extensions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Compile fix Created 8 years, 7 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 | Annotate | Revision Log
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/browser/extensions/bundle_installer.h" 5 #include "chrome/browser/extensions/bundle_installer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 browser_(NULL), 106 browser_(NULL),
107 profile_(profile), 107 profile_(profile),
108 delegate_(NULL) { 108 delegate_(NULL) {
109 BrowserList::AddObserver(this); 109 BrowserList::AddObserver(this);
110 for (size_t i = 0; i < items.size(); ++i) { 110 for (size_t i = 0; i < items.size(); ++i) {
111 items_[items[i].id] = items[i]; 111 items_[items[i].id] = items[i];
112 items_[items[i].id].state = Item::STATE_PENDING; 112 items_[items[i].id].state = Item::STATE_PENDING;
113 } 113 }
114 } 114 }
115 115
116 BundleInstaller::~BundleInstaller() {
117 BrowserList::RemoveObserver(this);
118 }
119
120 BundleInstaller::ItemList BundleInstaller::GetItemsWithState( 116 BundleInstaller::ItemList BundleInstaller::GetItemsWithState(
121 Item::State state) const { 117 Item::State state) const {
122 ItemList list; 118 ItemList list;
123 119
124 for (ItemMap::const_iterator i = items_.begin(); i != items_.end(); ++i) { 120 for (ItemMap::const_iterator i = items_.begin(); i != items_.end(); ++i) {
125 if (i->second.state == state) 121 if (i->second.state == state)
126 list.push_back(i->second); 122 list.push_back(i->second);
127 } 123 }
128 124
129 return list; 125 return list;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 CHECK_LT(static_cast<size_t>(state), arraysize(kHeadingIds)); 194 CHECK_LT(static_cast<size_t>(state), arraysize(kHeadingIds));
199 CHECK_LT(index, arraysize(kHeadingIds[state])); 195 CHECK_LT(index, arraysize(kHeadingIds[state]));
200 196
201 int msg_id = kHeadingIds[state][index]; 197 int msg_id = kHeadingIds[state][index];
202 if (!msg_id) 198 if (!msg_id)
203 return string16(); 199 return string16();
204 200
205 return l10n_util::GetStringUTF16(msg_id); 201 return l10n_util::GetStringUTF16(msg_id);
206 } 202 }
207 203
204 BundleInstaller::~BundleInstaller() {
205 BrowserList::RemoveObserver(this);
206 }
207
208 void BundleInstaller::ParseManifests() { 208 void BundleInstaller::ParseManifests() {
209 if (items_.empty()) { 209 if (items_.empty()) {
210 ReportCanceled(false); 210 ReportCanceled(false);
211 return; 211 return;
212 } 212 }
213 213
214 for (ItemMap::iterator i = items_.begin(); i != items_.end(); ++i) { 214 for (ItemMap::iterator i = items_.begin(); i != items_.end(); ++i) {
215 scoped_refptr<WebstoreInstallHelper> helper = new WebstoreInstallHelper( 215 scoped_refptr<WebstoreInstallHelper> helper = new WebstoreInstallHelper(
216 this, i->first, i->second.manifest, "", GURL(), NULL); 216 this, i->first, i->second.manifest, "", GURL(), NULL);
217 helper->Start(); 217 helper->Start();
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 items_[id].state = Item::STATE_FAILED; 324 items_[id].state = Item::STATE_FAILED;
325 325
326 ExtensionList::iterator i = std::find_if( 326 ExtensionList::iterator i = std::find_if(
327 dummy_extensions_.begin(), dummy_extensions_.end(), MatchIdFunctor(id)); 327 dummy_extensions_.begin(), dummy_extensions_.end(), MatchIdFunctor(id));
328 CHECK(dummy_extensions_.end() != i); 328 CHECK(dummy_extensions_.end() != i);
329 dummy_extensions_.erase(i); 329 dummy_extensions_.erase(i);
330 330
331 ShowInstalledBubbleIfDone(); 331 ShowInstalledBubbleIfDone();
332 } 332 }
333 333
334 void BundleInstaller::OnBrowserAdded(const Browser* browser) { 334 void BundleInstaller::OnBrowserAdded(const Browser* browser) {}
335 }
336 335
337 void BundleInstaller::OnBrowserRemoved(const Browser* browser) { 336 void BundleInstaller::OnBrowserRemoved(const Browser* browser) {
338 if (browser_ == browser) 337 if (browser_ == browser)
339 browser_ = NULL; 338 browser_ = NULL;
340 } 339 }
341 340
342 void BundleInstaller::OnBrowserSetLastActive(const Browser* browser) { 341 void BundleInstaller::OnBrowserSetLastActive(const Browser* browser) {}
343 }
344 342
345 } // namespace extensions 343 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/bundle_installer.h ('k') | chrome/browser/extensions/execute_code_in_tab_function.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698