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

Side by Side Diff: chrome/browser/ui/intents/web_intent_picker_model.cc

Issue 10855066: intents: Remove the disposition enum in web intents model. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix mock type. Created 8 years, 4 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/ui/intents/web_intent_picker_model.h" 5 #include "chrome/browser/ui/intents/web_intent_picker_model.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 12 matching lines...) Expand all
23 23
24 WebIntentPickerModel::WebIntentPickerModel() 24 WebIntentPickerModel::WebIntentPickerModel()
25 : observer_(NULL), 25 : observer_(NULL),
26 waiting_for_suggestions_(true) { 26 waiting_for_suggestions_(true) {
27 } 27 }
28 28
29 WebIntentPickerModel::~WebIntentPickerModel() { 29 WebIntentPickerModel::~WebIntentPickerModel() {
30 DestroyAll(); 30 DestroyAll();
31 } 31 }
32 32
33 void WebIntentPickerModel::AddInstalledService(const string16& title, 33 void WebIntentPickerModel::AddInstalledService(
34 const GURL& url, 34 const string16& title,
35 Disposition disposition) { 35 const GURL& url,
36 webkit_glue::WebIntentServiceData::Disposition disposition) {
36 // TODO(groby): Revisit to remove O(n^2) complexity. 37 // TODO(groby): Revisit to remove O(n^2) complexity.
37 for (size_t i = 0; i < installed_services_.size(); ++i) { 38 for (size_t i = 0; i < installed_services_.size(); ++i) {
38 InstalledService* service = installed_services_[i]; 39 InstalledService* service = installed_services_[i];
39 if (service->title == title && service->url == url && 40 if (service->title == title && service->url == url &&
40 service->disposition == disposition) 41 service->disposition == disposition)
41 return; 42 return;
42 } 43 }
43 installed_services_.push_back(new InstalledService(title, url, disposition)); 44 installed_services_.push_back(new InstalledService(title, url, disposition));
44 if (observer_) 45 if (observer_)
45 observer_->OnModelChanged(this); 46 observer_->OnModelChanged(this);
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 } 169 }
169 170
170 void WebIntentPickerModel::DestroyAll() { 171 void WebIntentPickerModel::DestroyAll() {
171 STLDeleteElements(&installed_services_); 172 STLDeleteElements(&installed_services_);
172 STLDeleteElements(&suggested_extensions_); 173 STLDeleteElements(&suggested_extensions_);
173 } 174 }
174 175
175 WebIntentPickerModel::InstalledService::InstalledService( 176 WebIntentPickerModel::InstalledService::InstalledService(
176 const string16& title, 177 const string16& title,
177 const GURL& url, 178 const GURL& url,
178 Disposition disposition) 179 webkit_glue::WebIntentServiceData::Disposition disposition)
179 : title(title), 180 : title(title),
180 url(url), 181 url(url),
181 favicon(ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed( 182 favicon(ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed(
182 IDR_DEFAULT_FAVICON)), 183 IDR_DEFAULT_FAVICON)),
183 disposition(disposition) { 184 disposition(disposition) {
184 } 185 }
185 186
186 WebIntentPickerModel::InstalledService::~InstalledService() { 187 WebIntentPickerModel::InstalledService::~InstalledService() {
187 } 188 }
188 189
189 WebIntentPickerModel::SuggestedExtension::SuggestedExtension( 190 WebIntentPickerModel::SuggestedExtension::SuggestedExtension(
190 const string16& title, 191 const string16& title,
191 const string16& id, 192 const string16& id,
192 double average_rating) 193 double average_rating)
193 : title(title), 194 : title(title),
194 id(id), 195 id(id),
195 average_rating(average_rating), 196 average_rating(average_rating),
196 icon(ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed( 197 icon(ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed(
197 IDR_DEFAULT_FAVICON)) { 198 IDR_DEFAULT_FAVICON)) {
198 } 199 }
199 200
200 WebIntentPickerModel::SuggestedExtension::~SuggestedExtension() { 201 WebIntentPickerModel::SuggestedExtension::~SuggestedExtension() {
201 } 202 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/intents/web_intent_picker_model.h ('k') | chrome/browser/ui/intents/web_intent_picker_model_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698