Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/views/passwords/manage_passwords_bubble_view.h" | 5 #include "chrome/browser/ui/views/passwords/manage_passwords_bubble_view.h" |
| 6 | 6 |
| 7 #include "chrome/browser/chrome_notification_types.h" | |
| 7 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
| 8 #include "chrome/browser/ui/browser_finder.h" | 9 #include "chrome/browser/ui/browser_finder.h" |
| 10 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" | |
| 9 #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h" | 11 #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h" |
| 10 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" | 12 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" |
| 11 #include "chrome/browser/ui/passwords/save_password_refusal_combobox_model.h" | 13 #include "chrome/browser/ui/passwords/save_password_refusal_combobox_model.h" |
| 12 #include "chrome/browser/ui/views/frame/browser_view.h" | 14 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 13 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 15 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 14 #include "chrome/browser/ui/views/passwords/manage_password_item_view.h" | 16 #include "chrome/browser/ui/views/passwords/manage_password_item_view.h" |
| 15 #include "chrome/browser/ui/views/passwords/manage_passwords_icon_view.h" | 17 #include "chrome/browser/ui/views/passwords/manage_passwords_icon_view.h" |
| 16 #include "chrome/grit/generated_resources.h" | 18 #include "chrome/grit/generated_resources.h" |
| 19 #include "content/public/browser/notification_source.h" | |
|
Mike West
2014/10/14 11:09:47
You never use NotificationSource. I think you can
vasilii
2014/10/22 12:14:35
Line 788?
| |
| 17 #include "content/public/browser/render_view_host.h" | 20 #include "content/public/browser/render_view_host.h" |
| 18 #include "content/public/browser/web_contents.h" | 21 #include "content/public/browser/web_contents.h" |
| 19 #include "ui/aura/window.h" | 22 #include "ui/aura/window.h" |
| 20 #include "ui/base/l10n/l10n_util.h" | 23 #include "ui/base/l10n/l10n_util.h" |
| 21 #include "ui/base/resource/resource_bundle.h" | 24 #include "ui/base/resource/resource_bundle.h" |
| 22 #include "ui/views/controls/button/blue_button.h" | 25 #include "ui/views/controls/button/blue_button.h" |
| 23 #include "ui/views/controls/button/label_button.h" | 26 #include "ui/views/controls/button/label_button.h" |
| 24 #include "ui/views/controls/combobox/combobox.h" | 27 #include "ui/views/controls/combobox/combobox.h" |
| 25 #include "ui/views/controls/combobox/combobox_listener.h" | 28 #include "ui/views/controls/combobox/combobox_listener.h" |
| 26 #include "ui/views/controls/link.h" | 29 #include "ui/views/controls/link.h" |
| 27 #include "ui/views/controls/link_listener.h" | 30 #include "ui/views/controls/link_listener.h" |
| 28 #include "ui/views/controls/styled_label.h" | 31 #include "ui/views/controls/styled_label.h" |
| 29 #include "ui/views/controls/styled_label_listener.h" | 32 #include "ui/views/controls/styled_label_listener.h" |
| 30 #include "ui/views/layout/fill_layout.h" | 33 #include "ui/views/layout/fill_layout.h" |
| 31 #include "ui/views/layout/grid_layout.h" | 34 #include "ui/views/layout/grid_layout.h" |
| 32 #include "ui/views/layout/layout_constants.h" | 35 #include "ui/views/layout/layout_constants.h" |
| 36 #include "ui/wm/core/window_animations.h" | |
| 33 | 37 |
| 34 | 38 |
| 35 // Helpers -------------------------------------------------------------------- | 39 // Helpers -------------------------------------------------------------------- |
| 36 | 40 |
| 37 namespace { | 41 namespace { |
| 38 | 42 |
| 39 const int kDesiredBubbleWidth = 370; | 43 const int kDesiredBubbleWidth = 370; |
| 40 | 44 |
| 41 enum ColumnSetType { | 45 enum ColumnSetType { |
| 42 // | | (FILL, FILL) | | | 46 // | | (FILL, FILL) | | |
| (...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 768 anchor_view ? views::BubbleBorder::TOP_RIGHT | 772 anchor_view ? views::BubbleBorder::TOP_RIGHT |
| 769 : views::BubbleBorder::NONE), | 773 : views::BubbleBorder::NONE), |
| 770 anchor_view_(anchor_view), | 774 anchor_view_(anchor_view), |
| 771 never_save_passwords_(false), | 775 never_save_passwords_(false), |
| 772 initially_focused_view_(NULL) { | 776 initially_focused_view_(NULL) { |
| 773 // Compensate for built-in vertical padding in the anchor view's image. | 777 // Compensate for built-in vertical padding in the anchor view's image. |
| 774 set_anchor_view_insets(gfx::Insets(5, 0, 5, 0)); | 778 set_anchor_view_insets(gfx::Insets(5, 0, 5, 0)); |
| 775 if (anchor_view) | 779 if (anchor_view) |
| 776 anchor_view->SetActive(true); | 780 anchor_view->SetActive(true); |
| 777 mouse_handler_.reset(new WebContentMouseHandler(this)); | 781 mouse_handler_.reset(new WebContentMouseHandler(this)); |
| 782 | |
| 783 // Add observers to close the bubble if the fullscreen state changes. | |
| 784 Browser* browser = chrome::FindBrowserWithWebContents(web_contents); | |
| 785 registrar_.Add( | |
| 786 this, | |
| 787 chrome::NOTIFICATION_FULLSCREEN_CHANGED, | |
| 788 content::Source<FullscreenController>(browser->fullscreen_controller())); | |
| 778 } | 789 } |
| 779 | 790 |
| 780 ManagePasswordsBubbleView::~ManagePasswordsBubbleView() { | 791 ManagePasswordsBubbleView::~ManagePasswordsBubbleView() { |
| 781 if (anchor_view_) | 792 if (anchor_view_) |
| 782 anchor_view_->SetActive(false); | 793 anchor_view_->SetActive(false); |
| 783 } | 794 } |
| 784 | 795 |
| 785 void ManagePasswordsBubbleView::AdjustForFullscreen( | 796 void ManagePasswordsBubbleView::AdjustForFullscreen( |
| 786 const gfx::Rect& screen_bounds) { | 797 const gfx::Rect& screen_bounds) { |
| 787 if (GetAnchorView()) | 798 if (GetAnchorView()) |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 849 void ManagePasswordsBubbleView::WindowClosing() { | 860 void ManagePasswordsBubbleView::WindowClosing() { |
| 850 // Close() closes the window asynchronously, so by the time we reach here, | 861 // Close() closes the window asynchronously, so by the time we reach here, |
| 851 // |manage_passwords_bubble_| may have already been reset. | 862 // |manage_passwords_bubble_| may have already been reset. |
| 852 if (manage_passwords_bubble_ == this) | 863 if (manage_passwords_bubble_ == this) |
| 853 manage_passwords_bubble_ = NULL; | 864 manage_passwords_bubble_ = NULL; |
| 854 } | 865 } |
| 855 | 866 |
| 856 views::View* ManagePasswordsBubbleView::GetInitiallyFocusedView() { | 867 views::View* ManagePasswordsBubbleView::GetInitiallyFocusedView() { |
| 857 return initially_focused_view_; | 868 return initially_focused_view_; |
| 858 } | 869 } |
| 870 | |
| 871 void ManagePasswordsBubbleView::Observe( | |
| 872 int type, | |
| 873 const content::NotificationSource& source, | |
| 874 const content::NotificationDetails& details) { | |
| 875 DCHECK_EQ(type, chrome::NOTIFICATION_FULLSCREEN_CHANGED); | |
| 876 aura::Window* window = GetWidget()->GetNativeView(); | |
| 877 wm::SetWindowVisibilityAnimationTransition(window, wm::ANIMATE_NONE); | |
|
Mike West
2014/10/14 11:09:47
Is this not the default?
vasilii
2014/10/22 12:14:35
By default the bubble animates both showing and hi
| |
| 878 CloseBubble(); | |
| 879 } | |
| OLD | NEW |