OLD | NEW |
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 "base/memory/scoped_vector.h" | 8 #include "base/memory/scoped_vector.h" |
9 #include "base/time.h" | 9 #include "base/time.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 | 260 |
261 // Updates the service button view with new model data. | 261 // Updates the service button view with new model data. |
262 void Update(); | 262 void Update(); |
263 | 263 |
264 // Start a throbber on the service button that will launch the service at | 264 // Start a throbber on the service button that will launch the service at |
265 // |url|. | 265 // |url|. |
266 void StartThrobber(const GURL& url); | 266 void StartThrobber(const GURL& url); |
267 | 267 |
268 // views::ButtonListener implementation. | 268 // views::ButtonListener implementation. |
269 virtual void ButtonPressed(views::Button* sender, | 269 virtual void ButtonPressed(views::Button* sender, |
270 const views::Event& event) OVERRIDE; | 270 const ui::Event& event) OVERRIDE; |
271 | 271 |
272 virtual gfx::Size GetPreferredSize() OVERRIDE; | 272 virtual gfx::Size GetPreferredSize() OVERRIDE; |
273 | 273 |
274 protected: | 274 protected: |
275 virtual void OnEnabledChanged() OVERRIDE; | 275 virtual void OnEnabledChanged() OVERRIDE; |
276 | 276 |
277 private: | 277 private: |
278 const WebIntentPickerModel* model_; | 278 const WebIntentPickerModel* model_; |
279 Delegate* delegate_; | 279 Delegate* delegate_; |
280 | 280 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 continue; | 336 continue; |
337 | 337 |
338 ThrobberNativeTextButton* button = | 338 ThrobberNativeTextButton* button = |
339 static_cast<ThrobberNativeTextButton*>(child_at(i)); | 339 static_cast<ThrobberNativeTextButton*>(child_at(i)); |
340 button->StartThrobber(); | 340 button->StartThrobber(); |
341 return; | 341 return; |
342 } | 342 } |
343 } | 343 } |
344 | 344 |
345 void ServiceButtonsView::ButtonPressed(views::Button* sender, | 345 void ServiceButtonsView::ButtonPressed(views::Button* sender, |
346 const views::Event& event) { | 346 const ui::Event& event) { |
347 size_t index = static_cast<size_t>(sender->tag()); | 347 size_t index = static_cast<size_t>(sender->tag()); |
348 delegate_->OnServiceButtonClicked(model_->GetInstalledServiceAt(index)); | 348 delegate_->OnServiceButtonClicked(model_->GetInstalledServiceAt(index)); |
349 } | 349 } |
350 | 350 |
351 gfx::Size ServiceButtonsView::GetPreferredSize() { | 351 gfx::Size ServiceButtonsView::GetPreferredSize() { |
352 // If there are no service buttons, hide this view. | 352 // If there are no service buttons, hide this view. |
353 if (model_->GetInstalledServiceCount() == 0) | 353 if (model_->GetInstalledServiceCount() == 0) |
354 return gfx::Size(); | 354 return gfx::Size(); |
355 return GetLayoutManager()->GetPreferredSize(this); | 355 return GetLayoutManager()->GetPreferredSize(this); |
356 } | 356 } |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 virtual ~Delegate() {} | 446 virtual ~Delegate() {} |
447 }; | 447 }; |
448 | 448 |
449 SuggestedExtensionsRowView( | 449 SuggestedExtensionsRowView( |
450 const WebIntentPickerModel::SuggestedExtension* extension, | 450 const WebIntentPickerModel::SuggestedExtension* extension, |
451 Delegate* delegate); | 451 Delegate* delegate); |
452 virtual ~SuggestedExtensionsRowView(); | 452 virtual ~SuggestedExtensionsRowView(); |
453 | 453 |
454 // ButtonListener implementation. | 454 // ButtonListener implementation. |
455 virtual void ButtonPressed(views::Button* sender, | 455 virtual void ButtonPressed(views::Button* sender, |
456 const views::Event& event) OVERRIDE; | 456 const ui::Event& event) OVERRIDE; |
457 | 457 |
458 // LinkListener implementation. | 458 // LinkListener implementation. |
459 void LinkClicked(views::Link* source, int event_flags) OVERRIDE; | 459 void LinkClicked(views::Link* source, int event_flags) OVERRIDE; |
460 | 460 |
461 // Start an animating throbber for this row, and hide the star rating and the | 461 // Start an animating throbber for this row, and hide the star rating and the |
462 // install button. | 462 // install button. |
463 void StartThrobber(); | 463 void StartThrobber(); |
464 | 464 |
465 // Stop the throbber for this row, and show the star rating and the install | 465 // Stop the throbber for this row, and show the star rating and the install |
466 // button. | 466 // button. |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 | 516 |
517 install_button_= new ThrobberNativeTextButton( | 517 install_button_= new ThrobberNativeTextButton( |
518 this, l10n_util::GetStringUTF16(IDS_INTENT_PICKER_INSTALL_EXTENSION)); | 518 this, l10n_util::GetStringUTF16(IDS_INTENT_PICKER_INSTALL_EXTENSION)); |
519 AddChildView(install_button_); | 519 AddChildView(install_button_); |
520 } | 520 } |
521 | 521 |
522 SuggestedExtensionsRowView::~SuggestedExtensionsRowView() { | 522 SuggestedExtensionsRowView::~SuggestedExtensionsRowView() { |
523 } | 523 } |
524 | 524 |
525 void SuggestedExtensionsRowView::ButtonPressed(views::Button* sender, | 525 void SuggestedExtensionsRowView::ButtonPressed(views::Button* sender, |
526 const views::Event& event) { | 526 const ui::Event& event) { |
527 delegate_->OnExtensionInstallClicked(extension_->id); | 527 delegate_->OnExtensionInstallClicked(extension_->id); |
528 } | 528 } |
529 | 529 |
530 void SuggestedExtensionsRowView::LinkClicked(views::Link* source, | 530 void SuggestedExtensionsRowView::LinkClicked(views::Link* source, |
531 int event_flags) { | 531 int event_flags) { |
532 delegate_->OnExtensionLinkClicked(extension_->id); | 532 delegate_->OnExtensionLinkClicked(extension_->id); |
533 } | 533 } |
534 | 534 |
535 void SuggestedExtensionsRowView::StartThrobber() { | 535 void SuggestedExtensionsRowView::StartThrobber() { |
536 install_button_->StartThrobber(); | 536 install_button_->StartThrobber(); |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 public ServiceButtonsView::Delegate, | 659 public ServiceButtonsView::Delegate, |
660 public SuggestedExtensionsRowView::Delegate { | 660 public SuggestedExtensionsRowView::Delegate { |
661 public: | 661 public: |
662 WebIntentPickerViews(TabContents* tab_contents, | 662 WebIntentPickerViews(TabContents* tab_contents, |
663 WebIntentPickerDelegate* delegate, | 663 WebIntentPickerDelegate* delegate, |
664 WebIntentPickerModel* model); | 664 WebIntentPickerModel* model); |
665 virtual ~WebIntentPickerViews(); | 665 virtual ~WebIntentPickerViews(); |
666 | 666 |
667 // views::ButtonListener implementation. | 667 // views::ButtonListener implementation. |
668 virtual void ButtonPressed(views::Button* sender, | 668 virtual void ButtonPressed(views::Button* sender, |
669 const views::Event& event) OVERRIDE; | 669 const ui::Event& event) OVERRIDE; |
670 | 670 |
671 // views::DialogDelegate implementation. | 671 // views::DialogDelegate implementation. |
672 virtual void WindowClosing() OVERRIDE; | 672 virtual void WindowClosing() OVERRIDE; |
673 virtual void DeleteDelegate() OVERRIDE; | 673 virtual void DeleteDelegate() OVERRIDE; |
674 virtual views::Widget* GetWidget() OVERRIDE; | 674 virtual views::Widget* GetWidget() OVERRIDE; |
675 virtual const views::Widget* GetWidget() const OVERRIDE; | 675 virtual const views::Widget* GetWidget() const OVERRIDE; |
676 virtual views::View* GetContentsView() OVERRIDE; | 676 virtual views::View* GetContentsView() OVERRIDE; |
677 virtual int GetDialogButtons() const OVERRIDE; | 677 virtual int GetDialogButtons() const OVERRIDE; |
678 | 678 |
679 // LinkListener implementation. | 679 // LinkListener implementation. |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 | 810 |
811 // Show the dialog. | 811 // Show the dialog. |
812 window_ = new ConstrainedWindowViews(tab_contents, this); | 812 window_ = new ConstrainedWindowViews(tab_contents, this); |
813 } | 813 } |
814 | 814 |
815 WebIntentPickerViews::~WebIntentPickerViews() { | 815 WebIntentPickerViews::~WebIntentPickerViews() { |
816 model_->set_observer(NULL); | 816 model_->set_observer(NULL); |
817 } | 817 } |
818 | 818 |
819 void WebIntentPickerViews::ButtonPressed(views::Button* sender, | 819 void WebIntentPickerViews::ButtonPressed(views::Button* sender, |
820 const views::Event& event) { | 820 const ui::Event& event) { |
821 delegate_->OnPickerClosed(); | 821 delegate_->OnPickerClosed(); |
822 } | 822 } |
823 | 823 |
824 void WebIntentPickerViews::WindowClosing() { | 824 void WebIntentPickerViews::WindowClosing() { |
825 delegate_->OnClosing(); | 825 delegate_->OnClosing(); |
826 } | 826 } |
827 | 827 |
828 void WebIntentPickerViews::DeleteDelegate() { | 828 void WebIntentPickerViews::DeleteDelegate() { |
829 delete this; | 829 delete this; |
830 } | 830 } |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1191 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 1191 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
1192 views::ImageButton* close_button = new views::ImageButton(this); | 1192 views::ImageButton* close_button = new views::ImageButton(this); |
1193 close_button->SetImage(views::CustomButton::BS_NORMAL, | 1193 close_button->SetImage(views::CustomButton::BS_NORMAL, |
1194 rb.GetImageSkiaNamed(IDR_SHARED_IMAGES_X)); | 1194 rb.GetImageSkiaNamed(IDR_SHARED_IMAGES_X)); |
1195 close_button->SetImage(views::CustomButton::BS_HOT, | 1195 close_button->SetImage(views::CustomButton::BS_HOT, |
1196 rb.GetImageSkiaNamed(IDR_SHARED_IMAGES_X_HOVER)); | 1196 rb.GetImageSkiaNamed(IDR_SHARED_IMAGES_X_HOVER)); |
1197 close_button->SetImage(views::CustomButton::BS_PUSHED, | 1197 close_button->SetImage(views::CustomButton::BS_PUSHED, |
1198 rb.GetImageSkiaNamed(IDR_SHARED_IMAGES_X_HOVER)); | 1198 rb.GetImageSkiaNamed(IDR_SHARED_IMAGES_X_HOVER)); |
1199 return close_button; | 1199 return close_button; |
1200 } | 1200 } |
OLD | NEW |