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

Side by Side Diff: chrome/browser/ui/gtk/web_intent_picker_gtk.cc

Issue 9649020: [Web Intents] WebIntentPickerModel uses URL instead of index to reference registered services. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: mac fix Created 8 years, 9 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/gtk/web_intent_picker_gtk.h" 5 #include "chrome/browser/ui/gtk/web_intent_picker_gtk.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/i18n/rtl.h" 9 #include "base/i18n/rtl.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 void WebIntentPickerGtk::OnFaviconChanged(WebIntentPickerModel* model, 144 void WebIntentPickerGtk::OnFaviconChanged(WebIntentPickerModel* model,
145 size_t index) { 145 size_t index) {
146 UpdateInstalledServices(); 146 UpdateInstalledServices();
147 } 147 }
148 148
149 void WebIntentPickerGtk::OnExtensionIconChanged(WebIntentPickerModel* model, 149 void WebIntentPickerGtk::OnExtensionIconChanged(WebIntentPickerModel* model,
150 const string16& extension_id) { 150 const string16& extension_id) {
151 UpdateSuggestedExtensions(); 151 UpdateSuggestedExtensions();
152 } 152 }
153 153
154 void WebIntentPickerGtk::OnInlineDisposition(WebIntentPickerModel* model) { 154 void WebIntentPickerGtk::OnInlineDisposition(WebIntentPickerModel* model,
155 const WebIntentPickerModel::InstalledService& installed_service = 155 const GURL& url) {
156 model->GetInstalledServiceAt(model->inline_disposition_index());
157 const GURL& url = installed_service.url;
158
159 content::WebContents* web_contents = content::WebContents::Create( 156 content::WebContents* web_contents = content::WebContents::Create(
160 browser_->profile(), NULL, MSG_ROUTING_NONE, NULL, NULL); 157 browser_->profile(), NULL, MSG_ROUTING_NONE, NULL, NULL);
161 inline_disposition_tab_contents_.reset(new TabContentsWrapper(web_contents)); 158 inline_disposition_tab_contents_.reset(new TabContentsWrapper(web_contents));
162 inline_disposition_delegate_.reset(new WebIntentInlineDispositionDelegate); 159 inline_disposition_delegate_.reset(new WebIntentInlineDispositionDelegate);
163 web_contents->SetDelegate(inline_disposition_delegate_.get()); 160 web_contents->SetDelegate(inline_disposition_delegate_.get());
164 161
165 // Must call this immediately after WebContents creation to avoid race 162 // Must call this immediately after WebContents creation to avoid race
166 // with load. 163 // with load.
167 delegate_->OnInlineDispositionWebContentsCreated(web_contents); 164 delegate_->OnInlineDispositionWebContentsCreated(web_contents);
168 165
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 } 276 }
280 277
281 void WebIntentPickerGtk::OnServiceButtonClick(GtkWidget* button) { 278 void WebIntentPickerGtk::OnServiceButtonClick(GtkWidget* button) {
282 GList* button_list = gtk_container_get_children(GTK_CONTAINER(button_vbox_)); 279 GList* button_list = gtk_container_get_children(GTK_CONTAINER(button_vbox_));
283 gint index = g_list_index(button_list, button); 280 gint index = g_list_index(button_list, button);
284 DCHECK(index != -1); 281 DCHECK(index != -1);
285 282
286 const WebIntentPickerModel::InstalledService& installed_service = 283 const WebIntentPickerModel::InstalledService& installed_service =
287 model_->GetInstalledServiceAt(index); 284 model_->GetInstalledServiceAt(index);
288 285
289 delegate_->OnServiceChosen(static_cast<size_t>(index), 286 delegate_->OnServiceChosen(installed_service.url,
290 installed_service.disposition); 287 installed_service.disposition);
291 } 288 }
292 289
293 void WebIntentPickerGtk::InitContents() { 290 void WebIntentPickerGtk::InitContents() {
294 ThemeServiceGtk* theme_service = GetThemeService(wrapper_); 291 ThemeServiceGtk* theme_service = GetThemeService(wrapper_);
295 292
296 // Main contents vbox. 293 // Main contents vbox.
297 contents_ = gtk_vbox_new(FALSE, ui::kContentAreaSpacing); 294 contents_ = gtk_vbox_new(FALSE, ui::kContentAreaSpacing);
298 gtk_container_set_border_width(GTK_CONTAINER(contents_), 295 gtk_container_set_border_width(GTK_CONTAINER(contents_),
299 ui::kContentAreaBorder); 296 ui::kContentAreaBorder);
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 for (int i = 0; i < 5; ++i) { 466 for (int i = 0; i < 5; ++i) {
470 gtk_box_pack_start( 467 gtk_box_pack_start(
471 GTK_BOX(hbox), 468 GTK_BOX(hbox),
472 gtk_image_new_from_pixbuf(rb.GetRTLEnabledPixbufNamed( 469 gtk_image_new_from_pixbuf(rb.GetRTLEnabledPixbufNamed(
473 WebIntentPicker::GetNthStarImageIdFromCWSRating(rating, i))), 470 WebIntentPicker::GetNthStarImageIdFromCWSRating(rating, i))),
474 FALSE, FALSE, 0); 471 FALSE, FALSE, 0);
475 } 472 }
476 473
477 return hbox; 474 return hbox;
478 } 475 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/web_intent_picker_gtk.h ('k') | chrome/browser/ui/intents/web_intent_picker_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698