OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/autofill/password_generation_popup_view_views.
h" | 5 #include "chrome/browser/ui/views/autofill/password_generation_popup_view_views.
h" |
6 | 6 |
7 #include "base/strings/string16.h" | 7 #include "base/strings/string16.h" |
8 #include "chrome/browser/ui/autofill/password_generation_popup_controller.h" | 8 #include "chrome/browser/ui/autofill/password_generation_popup_controller.h" |
9 #include "chrome/browser/ui/autofill/popup_constants.h" | 9 #include "chrome/browser/ui/autofill/popup_constants.h" |
10 #include "grit/theme_resources.h" | 10 #include "grit/theme_resources.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 PasswordTextBox() {} | 33 PasswordTextBox() {} |
34 virtual ~PasswordTextBox() {} | 34 virtual ~PasswordTextBox() {} |
35 | 35 |
36 // |suggestion_text| prompts the user to select the password, | 36 // |suggestion_text| prompts the user to select the password, |
37 // |generated_password| is the generated password, and |font_list| is the font | 37 // |generated_password| is the generated password, and |font_list| is the font |
38 // used for all text in this class. | 38 // used for all text in this class. |
39 void Init(const base::string16& suggestion_text, | 39 void Init(const base::string16& suggestion_text, |
40 const base::string16& generated_password, | 40 const base::string16& generated_password, |
41 const gfx::FontList& font_list) { | 41 const gfx::FontList& font_list) { |
42 views::BoxLayout* box_layout = new views::BoxLayout( | 42 views::BoxLayout* box_layout = new views::BoxLayout( |
43 views::BoxLayout::kVertical, 0, 10, 5); | 43 views::BoxLayout::kVertical, 0, 12, 5); |
44 box_layout->set_main_axis_alignment( | 44 box_layout->set_main_axis_alignment( |
45 views::BoxLayout::MAIN_AXIS_ALIGNMENT_START); | 45 views::BoxLayout::MAIN_AXIS_ALIGNMENT_START); |
46 SetLayoutManager(box_layout); | 46 SetLayoutManager(box_layout); |
47 | 47 |
48 views::Label* suggestion_label = new views::Label( | 48 views::Label* suggestion_label = new views::Label( |
49 suggestion_text, font_list.DeriveWithStyle(gfx::Font::BOLD)); | 49 suggestion_text, font_list.DeriveWithStyle(gfx::Font::BOLD)); |
50 suggestion_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 50 suggestion_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
51 suggestion_label->SetEnabledColor( | 51 suggestion_label->SetEnabledColor( |
52 PasswordGenerationPopupViewViews::kItemTextColor); | 52 PasswordGenerationPopupView::kPasswordTextColor); |
53 AddChildView(suggestion_label); | 53 AddChildView(suggestion_label); |
54 | 54 |
55 views::Label* password_label = | 55 views::Label* password_label = |
56 new views::Label(generated_password, font_list); | 56 new views::Label(generated_password, font_list); |
57 password_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 57 password_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
58 password_label->SetEnabledColor( | 58 password_label->SetEnabledColor( |
59 PasswordGenerationPopupViewViews::kItemTextColor); | 59 PasswordGenerationPopupView::kPasswordTextColor); |
60 AddChildView(password_label); | 60 AddChildView(password_label); |
61 } | 61 } |
62 | 62 |
63 // views::View: | 63 // views::View: |
64 virtual bool CanProcessEventsWithinSubtree() const OVERRIDE { | 64 virtual bool CanProcessEventsWithinSubtree() const OVERRIDE { |
65 // Send events to the parent view for handling. | 65 // Send events to the parent view for handling. |
66 return false; | 66 return false; |
67 } | 67 } |
68 | 68 |
69 private: | 69 private: |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 | 265 |
266 // If the top level widget can't be found, cancel the popup since we can't | 266 // If the top level widget can't be found, cancel the popup since we can't |
267 // fully set it up. | 267 // fully set it up. |
268 if (!observing_widget) | 268 if (!observing_widget) |
269 return NULL; | 269 return NULL; |
270 | 270 |
271 return new PasswordGenerationPopupViewViews(controller, observing_widget); | 271 return new PasswordGenerationPopupViewViews(controller, observing_widget); |
272 } | 272 } |
273 | 273 |
274 } // namespace autofill | 274 } // namespace autofill |
OLD | NEW |