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 "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/metrics/user_metrics.h" | 8 #include "base/metrics/user_metrics.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "base/timer/timer.h" | 10 #include "base/timer/timer.h" |
11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
13 #include "chrome/browser/ui/browser_finder.h" | 13 #include "chrome/browser/ui/browser_finder.h" |
14 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" | 14 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" |
15 #include "chrome/browser/ui/passwords/password_dialog_prompts.h" | 15 #include "chrome/browser/ui/passwords/password_dialog_prompts.h" |
16 #include "chrome/browser/ui/passwords/passwords_model_delegate.h" | 16 #include "chrome/browser/ui/passwords/passwords_model_delegate.h" |
17 #include "chrome/browser/ui/views/frame/browser_view.h" | 17 #include "chrome/browser/ui/views/frame/browser_view.h" |
18 #include "chrome/browser/ui/views/harmony/chrome_layout_provider.h" | 18 #include "chrome/browser/ui/views/harmony/chrome_layout_provider.h" |
Peter Kasting
2017/04/17 19:53:36
Nit: Can remove this now?
kylix_rd
2017/04/18 16:05:16
Yes. Done.
| |
19 #include "chrome/browser/ui/views/passwords/credentials_item_view.h" | 19 #include "chrome/browser/ui/views/passwords/credentials_item_view.h" |
20 #include "chrome/browser/ui/views/passwords/credentials_selection_view.h" | 20 #include "chrome/browser/ui/views/passwords/credentials_selection_view.h" |
21 #include "chrome/browser/ui/views/passwords/manage_password_items_view.h" | 21 #include "chrome/browser/ui/views/passwords/manage_password_items_view.h" |
22 #include "chrome/browser/ui/views/passwords/manage_passwords_icon_views.h" | 22 #include "chrome/browser/ui/views/passwords/manage_passwords_icon_views.h" |
23 #include "chrome/grit/generated_resources.h" | 23 #include "chrome/grit/generated_resources.h" |
24 #include "components/strings/grit/components_strings.h" | 24 #include "components/strings/grit/components_strings.h" |
25 #include "ui/base/l10n/l10n_util.h" | 25 #include "ui/base/l10n/l10n_util.h" |
26 #include "ui/base/material_design/material_design_controller.h" | 26 #include "ui/base/material_design/material_design_controller.h" |
27 #include "ui/base/resource/resource_bundle.h" | 27 #include "ui/base/resource/resource_bundle.h" |
28 #include "ui/gfx/color_palette.h" | 28 #include "ui/gfx/color_palette.h" |
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
761 ManagePasswordsBubbleView::ManagePasswordsBubbleView( | 761 ManagePasswordsBubbleView::ManagePasswordsBubbleView( |
762 content::WebContents* web_contents, | 762 content::WebContents* web_contents, |
763 views::View* anchor_view, | 763 views::View* anchor_view, |
764 DisplayReason reason) | 764 DisplayReason reason) |
765 : LocationBarBubbleDelegateView(anchor_view, web_contents), | 765 : LocationBarBubbleDelegateView(anchor_view, web_contents), |
766 model_(PasswordsModelDelegateFromWebContents(web_contents), | 766 model_(PasswordsModelDelegateFromWebContents(web_contents), |
767 reason == AUTOMATIC ? ManagePasswordsBubbleModel::AUTOMATIC | 767 reason == AUTOMATIC ? ManagePasswordsBubbleModel::AUTOMATIC |
768 : ManagePasswordsBubbleModel::USER_ACTION), | 768 : ManagePasswordsBubbleModel::USER_ACTION), |
769 initially_focused_view_(nullptr) { | 769 initially_focused_view_(nullptr) { |
770 mouse_handler_.reset(new WebContentMouseHandler(this, this->web_contents())); | 770 mouse_handler_.reset(new WebContentMouseHandler(this, this->web_contents())); |
771 // Set title margins to make the title and the content left aligned. | |
772 const int side_margin = margins().left(); | |
773 set_title_margins(gfx::Insets(ChromeLayoutProvider::Get()->GetDistanceMetric( | |
774 DISTANCE_PANEL_CONTENT_MARGIN), | |
775 side_margin, 0, side_margin)); | |
776 } | 771 } |
777 | 772 |
778 ManagePasswordsBubbleView::~ManagePasswordsBubbleView() { | 773 ManagePasswordsBubbleView::~ManagePasswordsBubbleView() { |
779 if (manage_passwords_bubble_ == this) | 774 if (manage_passwords_bubble_ == this) |
780 manage_passwords_bubble_ = NULL; | 775 manage_passwords_bubble_ = NULL; |
781 } | 776 } |
782 | 777 |
783 views::View* ManagePasswordsBubbleView::GetInitiallyFocusedView() { | 778 views::View* ManagePasswordsBubbleView::GetInitiallyFocusedView() { |
784 return initially_focused_view_; | 779 return initially_focused_view_; |
785 } | 780 } |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
856 } else if (model_.state() == | 851 } else if (model_.state() == |
857 password_manager::ui::CHROME_DESKTOP_IOS_PROMO_STATE) { | 852 password_manager::ui::CHROME_DESKTOP_IOS_PROMO_STATE) { |
858 AddChildView(new DesktopIOSPromotionBubbleView( | 853 AddChildView(new DesktopIOSPromotionBubbleView( |
859 model_.GetProfile(), | 854 model_.GetProfile(), |
860 desktop_ios_promotion::PromotionEntryPoint::SAVE_PASSWORD_BUBBLE)); | 855 desktop_ios_promotion::PromotionEntryPoint::SAVE_PASSWORD_BUBBLE)); |
861 #endif | 856 #endif |
862 } else { | 857 } else { |
863 AddChildView(new ManageView(this)); | 858 AddChildView(new ManageView(this)); |
864 } | 859 } |
865 } | 860 } |
OLD | NEW |