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

Side by Side Diff: chrome/browser/ui/views/web_intent_picker_views.cc

Issue 9430025: [Web Intents] WebIntentsPickerController will now fetch icon for suggested extensions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge 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
« no previous file with comments | « chrome/browser/ui/intents/web_intent_picker_model_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <algorithm> 5 #include <algorithm>
6 #include <vector> 6 #include <vector>
7 7
8 #include "chrome/browser/ui/browser.h" 8 #include "chrome/browser/ui/browser.h"
9 #include "chrome/browser/ui/intents/web_intent_inline_disposition_delegate.h" 9 #include "chrome/browser/ui/intents/web_intent_inline_disposition_delegate.h"
10 #include "chrome/browser/ui/intents/web_intent_picker_delegate.h" 10 #include "chrome/browser/ui/intents/web_intent_picker_delegate.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 virtual views::View* GetContentsView() OVERRIDE; 99 virtual views::View* GetContentsView() OVERRIDE;
100 virtual int GetDialogButtons() const OVERRIDE; 100 virtual int GetDialogButtons() const OVERRIDE;
101 101
102 // WebIntentPicker implementation. 102 // WebIntentPicker implementation.
103 virtual void Close() OVERRIDE; 103 virtual void Close() OVERRIDE;
104 104
105 // WebIntentPickerModelObserver implementation. 105 // WebIntentPickerModelObserver implementation.
106 virtual void OnModelChanged(WebIntentPickerModel* model) OVERRIDE; 106 virtual void OnModelChanged(WebIntentPickerModel* model) OVERRIDE;
107 virtual void OnFaviconChanged(WebIntentPickerModel* model, 107 virtual void OnFaviconChanged(WebIntentPickerModel* model,
108 size_t index) OVERRIDE; 108 size_t index) OVERRIDE;
109 virtual void OnExtensionIconChanged(WebIntentPickerModel* model,
110 const string16& extension_id) OVERRIDE;
109 virtual void OnInlineDisposition(WebIntentPickerModel* model) OVERRIDE; 111 virtual void OnInlineDisposition(WebIntentPickerModel* model) OVERRIDE;
110 112
111 private: 113 private:
112 // Initialize the contents of the picker. After this call, contents_ will be 114 // Initialize the contents of the picker. After this call, contents_ will be
113 // non-NULL. 115 // non-NULL.
114 void InitContents(); 116 void InitContents();
115 117
116 // Resize the constrained window to the size of its contents. 118 // Resize the constrained window to the size of its contents.
117 void SizeToContents(); 119 void SizeToContents();
118 120
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 void WebIntentPickerViews::OnFaviconChanged(WebIntentPickerModel* model, 244 void WebIntentPickerViews::OnFaviconChanged(WebIntentPickerModel* model,
243 size_t index) { 245 size_t index) {
244 const WebIntentPickerModel::InstalledService& installed_service = 246 const WebIntentPickerModel::InstalledService& installed_service =
245 model_->GetInstalledServiceAt(index); 247 model_->GetInstalledServiceAt(index);
246 views::TextButton* button = buttons_[index]; 248 views::TextButton* button = buttons_[index];
247 button->SetIcon(*installed_service.favicon.ToSkBitmap()); 249 button->SetIcon(*installed_service.favicon.ToSkBitmap());
248 contents_->Layout(); 250 contents_->Layout();
249 SizeToContents(); 251 SizeToContents();
250 } 252 }
251 253
254 void WebIntentPickerViews::OnExtensionIconChanged(
255 WebIntentPickerModel* model,
256 const string16& extension_id) {
257 // TODO(binji): implement.
258 }
259
252 void WebIntentPickerViews::OnInlineDisposition( 260 void WebIntentPickerViews::OnInlineDisposition(
253 WebIntentPickerModel* model) { 261 WebIntentPickerModel* model) {
254 const WebIntentPickerModel::InstalledService& installed_service = 262 const WebIntentPickerModel::InstalledService& installed_service =
255 model->GetInstalledServiceAt(model->inline_disposition_index()); 263 model->GetInstalledServiceAt(model->inline_disposition_index());
256 264
257 WebContents* web_contents = WebContents::Create( 265 WebContents* web_contents = WebContents::Create(
258 browser_->profile(), NULL, MSG_ROUTING_NONE, NULL, NULL); 266 browser_->profile(), NULL, MSG_ROUTING_NONE, NULL, NULL);
259 inline_disposition_delegate_.reset(new WebIntentInlineDispositionDelegate); 267 inline_disposition_delegate_.reset(new WebIntentInlineDispositionDelegate);
260 web_contents->SetDelegate(inline_disposition_delegate_.get()); 268 web_contents->SetDelegate(inline_disposition_delegate_.get());
261 269
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 } 325 }
318 326
319 void WebIntentPickerViews::SizeToContents() { 327 void WebIntentPickerViews::SizeToContents() {
320 gfx::Size client_size = contents_->GetPreferredSize(); 328 gfx::Size client_size = contents_->GetPreferredSize();
321 gfx::Rect client_bounds(client_size); 329 gfx::Rect client_bounds(client_size);
322 gfx::Rect new_window_bounds = window_->non_client_view()->frame_view()-> 330 gfx::Rect new_window_bounds = window_->non_client_view()->frame_view()->
323 GetWindowBoundsForClientBounds(client_bounds); 331 GetWindowBoundsForClientBounds(client_bounds);
324 // TODO(binji): figure out how to get the constrained dialog centered... 332 // TODO(binji): figure out how to get the constrained dialog centered...
325 window_->SetSize(new_window_bounds.size()); 333 window_->SetSize(new_window_bounds.size());
326 } 334 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/intents/web_intent_picker_model_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698