| 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/profile_chooser_view.h" | 5 #include "chrome/browser/ui/views/profile_chooser_view.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/profiles/profile_info_util.h" | 10 #include "chrome/browser/profiles/profile_info_util.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 views::Link* CreateLink(const base::string16& link_text, | 80 views::Link* CreateLink(const base::string16& link_text, |
| 81 views::LinkListener* listener) { | 81 views::LinkListener* listener) { |
| 82 views::Link* link_button = new views::Link(link_text); | 82 views::Link* link_button = new views::Link(link_text); |
| 83 link_button->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 83 link_button->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 84 link_button->SetUnderline(false); | 84 link_button->SetUnderline(false); |
| 85 link_button->set_listener(listener); | 85 link_button->set_listener(listener); |
| 86 return link_button; | 86 return link_button; |
| 87 } | 87 } |
| 88 | 88 |
| 89 | 89 |
| 90 // HorizontalPaddingButtonBorder ---------------------------------------------- | |
| 91 | |
| 92 // A button border that adds padding before the icon and after the text. This | |
| 93 // is needed so that the button looks like it is spanning the entire parent | |
| 94 // view (especially when hovered over), but has the icon indented and aligned | |
| 95 // with the other items in the parent view. | |
| 96 class HorizontalPaddingButtonBorder : public views::TextButtonBorder { | |
| 97 public: | |
| 98 HorizontalPaddingButtonBorder() : views::TextButtonBorder() { | |
| 99 SetInsets(gfx::Insets(0, views::kButtonHEdgeMarginNew, | |
| 100 0, views::kButtonHEdgeMarginNew)); | |
| 101 }; | |
| 102 | |
| 103 virtual ~HorizontalPaddingButtonBorder() { | |
| 104 }; | |
| 105 | |
| 106 private: | |
| 107 // This function is pure virtual in the parent, so we must provide an | |
| 108 // implementation. | |
| 109 virtual void Paint(const views::View& view, gfx::Canvas* canvas) OVERRIDE { | |
| 110 }; | |
| 111 | |
| 112 DISALLOW_COPY_AND_ASSIGN(HorizontalPaddingButtonBorder); | |
| 113 }; | |
| 114 | |
| 115 | |
| 116 // BackgroundColorHoverButton ------------------------------------------------- | 90 // BackgroundColorHoverButton ------------------------------------------------- |
| 117 | 91 |
| 118 // A custom button that allows for setting a background color when hovered over. | 92 // A custom button that allows for setting a background color when hovered over. |
| 119 class BackgroundColorHoverButton : public views::TextButton { | 93 class BackgroundColorHoverButton : public views::TextButton { |
| 120 public: | 94 public: |
| 121 BackgroundColorHoverButton(views::ButtonListener* listener, | 95 BackgroundColorHoverButton(views::ButtonListener* listener, |
| 122 const base::string16& text, | 96 const base::string16& text, |
| 123 const gfx::ImageSkia& normal_icon, | 97 const gfx::ImageSkia& normal_icon, |
| 124 const gfx::ImageSkia& hover_icon); | 98 const gfx::ImageSkia& hover_icon); |
| 125 virtual ~BackgroundColorHoverButton(); | 99 virtual ~BackgroundColorHoverButton(); |
| 126 | 100 |
| 127 private: | 101 private: |
| 128 // views::TextButton: | 102 // views::TextButton: |
| 129 virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE; | 103 virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE; |
| 130 virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; | 104 virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; |
| 131 | 105 |
| 132 void OnHighlightStateChanged(); | 106 void OnHighlightStateChanged(); |
| 133 | 107 |
| 134 DISALLOW_COPY_AND_ASSIGN(BackgroundColorHoverButton); | 108 DISALLOW_COPY_AND_ASSIGN(BackgroundColorHoverButton); |
| 135 }; | 109 }; |
| 136 | 110 |
| 137 BackgroundColorHoverButton::BackgroundColorHoverButton( | 111 BackgroundColorHoverButton::BackgroundColorHoverButton( |
| 138 views::ButtonListener* listener, | 112 views::ButtonListener* listener, |
| 139 const string16& text, | 113 const string16& text, |
| 140 const gfx::ImageSkia& normal_icon, | 114 const gfx::ImageSkia& normal_icon, |
| 141 const gfx::ImageSkia& hover_icon) | 115 const gfx::ImageSkia& hover_icon) |
| 142 : views::TextButton(listener, text) { | 116 : views::TextButton(listener, text) { |
| 143 set_border(new HorizontalPaddingButtonBorder); | 117 scoped_ptr<views::TextButtonBorder> text_button_border( |
| 118 new views::TextButtonBorder()); |
| 119 text_button_border->SetInsets(gfx::Insets(0, views::kButtonHEdgeMarginNew, |
| 120 0, views::kButtonHEdgeMarginNew)); |
| 121 set_border(text_button_border.release()); |
| 144 set_min_height(kButtonHeight); | 122 set_min_height(kButtonHeight); |
| 145 set_icon_text_spacing(views::kItemLabelSpacing); | 123 set_icon_text_spacing(views::kItemLabelSpacing); |
| 146 SetIcon(normal_icon); | 124 SetIcon(normal_icon); |
| 147 SetHoverIcon(hover_icon); | 125 SetHoverIcon(hover_icon); |
| 148 SetPushedIcon(hover_icon); | 126 SetPushedIcon(hover_icon); |
| 149 SetHoverColor(GetNativeTheme()->GetSystemColor( | 127 SetHoverColor(GetNativeTheme()->GetSystemColor( |
| 150 ui::NativeTheme::kColorId_SelectedMenuItemForegroundColor)); | 128 ui::NativeTheme::kColorId_SelectedMenuItemForegroundColor)); |
| 151 OnHighlightStateChanged(); | 129 OnHighlightStateChanged(); |
| 152 } | 130 } |
| 153 | 131 |
| (...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 820 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 798 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
| 821 | 799 |
| 822 add_account_button_ = new views::BlueButton( | 800 add_account_button_ = new views::BlueButton( |
| 823 this, | 801 this, |
| 824 l10n_util::GetStringFUTF16(IDS_PROFILES_PROFILE_ADD_ACCOUNT_BUTTON, | 802 l10n_util::GetStringFUTF16(IDS_PROFILES_PROFILE_ADD_ACCOUNT_BUTTON, |
| 825 avatar_item.name)); | 803 avatar_item.name)); |
| 826 layout->StartRow(1, 0); | 804 layout->StartRow(1, 0); |
| 827 layout->AddView(add_account_button_); | 805 layout->AddView(add_account_button_); |
| 828 return view; | 806 return view; |
| 829 } | 807 } |
| OLD | NEW |