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" | |
19 #include "chrome/browser/ui/views/passwords/credentials_item_view.h" | 18 #include "chrome/browser/ui/views/passwords/credentials_item_view.h" |
20 #include "chrome/browser/ui/views/passwords/credentials_selection_view.h" | 19 #include "chrome/browser/ui/views/passwords/credentials_selection_view.h" |
21 #include "chrome/browser/ui/views/passwords/manage_password_items_view.h" | 20 #include "chrome/browser/ui/views/passwords/manage_password_items_view.h" |
22 #include "chrome/browser/ui/views/passwords/manage_passwords_icon_views.h" | 21 #include "chrome/browser/ui/views/passwords/manage_passwords_icon_views.h" |
23 #include "chrome/grit/generated_resources.h" | 22 #include "chrome/grit/generated_resources.h" |
24 #include "components/strings/grit/components_strings.h" | 23 #include "components/strings/grit/components_strings.h" |
25 #include "ui/base/l10n/l10n_util.h" | 24 #include "ui/base/l10n/l10n_util.h" |
26 #include "ui/base/material_design/material_design_controller.h" | 25 #include "ui/base/material_design/material_design_controller.h" |
27 #include "ui/base/resource/resource_bundle.h" | 26 #include "ui/base/resource/resource_bundle.h" |
28 #include "ui/gfx/color_palette.h" | 27 #include "ui/gfx/color_palette.h" |
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
761 ManagePasswordsBubbleView::ManagePasswordsBubbleView( | 760 ManagePasswordsBubbleView::ManagePasswordsBubbleView( |
762 content::WebContents* web_contents, | 761 content::WebContents* web_contents, |
763 views::View* anchor_view, | 762 views::View* anchor_view, |
764 DisplayReason reason) | 763 DisplayReason reason) |
765 : LocationBarBubbleDelegateView(anchor_view, web_contents), | 764 : LocationBarBubbleDelegateView(anchor_view, web_contents), |
766 model_(PasswordsModelDelegateFromWebContents(web_contents), | 765 model_(PasswordsModelDelegateFromWebContents(web_contents), |
767 reason == AUTOMATIC ? ManagePasswordsBubbleModel::AUTOMATIC | 766 reason == AUTOMATIC ? ManagePasswordsBubbleModel::AUTOMATIC |
768 : ManagePasswordsBubbleModel::USER_ACTION), | 767 : ManagePasswordsBubbleModel::USER_ACTION), |
769 initially_focused_view_(nullptr) { | 768 initially_focused_view_(nullptr) { |
770 mouse_handler_.reset(new WebContentMouseHandler(this, this->web_contents())); | 769 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 } | 770 } |
777 | 771 |
778 ManagePasswordsBubbleView::~ManagePasswordsBubbleView() { | 772 ManagePasswordsBubbleView::~ManagePasswordsBubbleView() { |
779 if (manage_passwords_bubble_ == this) | 773 if (manage_passwords_bubble_ == this) |
780 manage_passwords_bubble_ = NULL; | 774 manage_passwords_bubble_ = NULL; |
781 } | 775 } |
782 | 776 |
783 views::View* ManagePasswordsBubbleView::GetInitiallyFocusedView() { | 777 views::View* ManagePasswordsBubbleView::GetInitiallyFocusedView() { |
784 return initially_focused_view_; | 778 return initially_focused_view_; |
785 } | 779 } |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
863 } else if (model_.state() == | 857 } else if (model_.state() == |
864 password_manager::ui::CHROME_DESKTOP_IOS_PROMO_STATE) { | 858 password_manager::ui::CHROME_DESKTOP_IOS_PROMO_STATE) { |
865 AddChildView(new DesktopIOSPromotionBubbleView( | 859 AddChildView(new DesktopIOSPromotionBubbleView( |
866 model_.GetProfile(), | 860 model_.GetProfile(), |
867 desktop_ios_promotion::PromotionEntryPoint::SAVE_PASSWORD_BUBBLE)); | 861 desktop_ios_promotion::PromotionEntryPoint::SAVE_PASSWORD_BUBBLE)); |
868 #endif | 862 #endif |
869 } else { | 863 } else { |
870 AddChildView(new ManageView(this)); | 864 AddChildView(new ManageView(this)); |
871 } | 865 } |
872 } | 866 } |
OLD | NEW |