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

Side by Side Diff: chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc

Issue 2758323002: Broke out layout metric information from ViewsDelegate to LayoutProvider (Closed)
Patch Set: Final feedback addressed Created 3 years, 8 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
OLDNEW
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/layout_delegate.h" 18 #include "chrome/browser/ui/views/harmony/chrome_layout_provider.h"
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 734 matching lines...) Expand 10 before | Expand all | Expand 10 after
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. 771 // Set title margins to make the title and the content left aligned.
772 const int side_margin = margins().left(); 772 const int side_margin = margins().left();
773 set_title_margins( 773 set_title_margins(gfx::Insets(ChromeLayoutProvider::Get()->GetDistanceMetric(
774 gfx::Insets(LayoutDelegate::Get()->GetMetric( 774 DISTANCE_PANEL_CONTENT_MARGIN),
775 LayoutDelegate::Metric::PANEL_CONTENT_MARGIN), 775 side_margin, 0, side_margin));
776 side_margin, 0, side_margin));
777 } 776 }
778 777
779 ManagePasswordsBubbleView::~ManagePasswordsBubbleView() { 778 ManagePasswordsBubbleView::~ManagePasswordsBubbleView() {
780 if (manage_passwords_bubble_ == this) 779 if (manage_passwords_bubble_ == this)
781 manage_passwords_bubble_ = NULL; 780 manage_passwords_bubble_ = NULL;
782 } 781 }
783 782
784 views::View* ManagePasswordsBubbleView::GetInitiallyFocusedView() { 783 views::View* ManagePasswordsBubbleView::GetInitiallyFocusedView() {
785 return initially_focused_view_; 784 return initially_focused_view_;
786 } 785 }
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
857 } else if (model_.state() == 856 } else if (model_.state() ==
858 password_manager::ui::CHROME_DESKTOP_IOS_PROMO_STATE) { 857 password_manager::ui::CHROME_DESKTOP_IOS_PROMO_STATE) {
859 AddChildView(new DesktopIOSPromotionBubbleView( 858 AddChildView(new DesktopIOSPromotionBubbleView(
860 model_.GetProfile(), 859 model_.GetProfile(),
861 desktop_ios_promotion::PromotionEntryPoint::SAVE_PASSWORD_BUBBLE)); 860 desktop_ios_promotion::PromotionEntryPoint::SAVE_PASSWORD_BUBBLE));
862 #endif 861 #endif
863 } else { 862 } else {
864 AddChildView(new ManageView(this)); 863 AddChildView(new ManageView(this));
865 } 864 }
866 } 865 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698