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

Side by Side Diff: chrome/browser/ui/views/autofill/password_generation_popup_view_views.cc

Issue 686543002: Standardize usage of virtual/override/final specifiers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 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 14 matching lines...) Expand all
25 25
26 // The amount of whitespace that is present when there is no padding. Used 26 // The amount of whitespace that is present when there is no padding. Used
27 // to get the proper spacing in the help section. 27 // to get the proper spacing in the help section.
28 const int kHelpVerticalOffset = 5; 28 const int kHelpVerticalOffset = 5;
29 29
30 // Wrapper around just the text portions of the generation UI (password and 30 // Wrapper around just the text portions of the generation UI (password and
31 // prompting text). 31 // prompting text).
32 class PasswordTextBox : public views::View { 32 class PasswordTextBox : public views::View {
33 public: 33 public:
34 PasswordTextBox() {} 34 PasswordTextBox() {}
35 virtual ~PasswordTextBox() {} 35 ~PasswordTextBox() override {}
36 36
37 // |suggestion_text| prompts the user to select the password, 37 // |suggestion_text| prompts the user to select the password,
38 // |generated_password| is the generated password, and |font_list| is the font 38 // |generated_password| is the generated password, and |font_list| is the font
39 // used for all text in this class. 39 // used for all text in this class.
40 void Init(const base::string16& suggestion_text, 40 void Init(const base::string16& suggestion_text,
41 const base::string16& generated_password, 41 const base::string16& generated_password,
42 const gfx::FontList& font_list) { 42 const gfx::FontList& font_list) {
43 views::BoxLayout* box_layout = new views::BoxLayout( 43 views::BoxLayout* box_layout = new views::BoxLayout(
44 views::BoxLayout::kVertical, 0, 12, 5); 44 views::BoxLayout::kVertical, 0, 12, 5);
45 box_layout->set_main_axis_alignment( 45 box_layout->set_main_axis_alignment(
46 views::BoxLayout::MAIN_AXIS_ALIGNMENT_START); 46 views::BoxLayout::MAIN_AXIS_ALIGNMENT_START);
47 SetLayoutManager(box_layout); 47 SetLayoutManager(box_layout);
48 48
49 views::Label* suggestion_label = new views::Label( 49 views::Label* suggestion_label = new views::Label(
50 suggestion_text, font_list.DeriveWithStyle(gfx::Font::BOLD)); 50 suggestion_text, font_list.DeriveWithStyle(gfx::Font::BOLD));
51 suggestion_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); 51 suggestion_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
52 suggestion_label->SetEnabledColor( 52 suggestion_label->SetEnabledColor(
53 PasswordGenerationPopupView::kPasswordTextColor); 53 PasswordGenerationPopupView::kPasswordTextColor);
54 AddChildView(suggestion_label); 54 AddChildView(suggestion_label);
55 55
56 views::Label* password_label = 56 views::Label* password_label =
57 new views::Label(generated_password, font_list); 57 new views::Label(generated_password, font_list);
58 password_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); 58 password_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
59 password_label->SetEnabledColor( 59 password_label->SetEnabledColor(
60 PasswordGenerationPopupView::kPasswordTextColor); 60 PasswordGenerationPopupView::kPasswordTextColor);
61 AddChildView(password_label); 61 AddChildView(password_label);
62 } 62 }
63 63
64 // views::View: 64 // views::View:
65 virtual bool CanProcessEventsWithinSubtree() const override { 65 bool CanProcessEventsWithinSubtree() const override {
66 // Send events to the parent view for handling. 66 // Send events to the parent view for handling.
67 return false; 67 return false;
68 } 68 }
69 69
70 private: 70 private:
71 DISALLOW_COPY_AND_ASSIGN(PasswordTextBox); 71 DISALLOW_COPY_AND_ASSIGN(PasswordTextBox);
72 }; 72 };
73 73
74 } // namespace 74 } // namespace
75 75
76 // Class that shows the generated password and associated UI (currently a key 76 // Class that shows the generated password and associated UI (currently a key
77 // image and some explanatory text). 77 // image and some explanatory text).
78 class PasswordGenerationPopupViewViews::PasswordBox : public views::View { 78 class PasswordGenerationPopupViewViews::PasswordBox : public views::View {
79 public: 79 public:
80 PasswordBox() {} 80 PasswordBox() {}
81 virtual ~PasswordBox() {} 81 ~PasswordBox() override {}
82 82
83 // |password| is the generated password, |suggestion| is the text prompting 83 // |password| is the generated password, |suggestion| is the text prompting
84 // the user to select the password, and |font_list| is the font used for all 84 // the user to select the password, and |font_list| is the font used for all
85 // the text. 85 // the text.
86 void Init(const base::string16& password, 86 void Init(const base::string16& password,
87 const base::string16& suggestion, 87 const base::string16& suggestion,
88 const base::string16& accessible_name, 88 const base::string16& accessible_name,
89 const gfx::FontList& font_list) { 89 const gfx::FontList& font_list) {
90 accessible_name_ = accessible_name; 90 accessible_name_ = accessible_name;
91 91
(...skipping 13 matching lines...) Expand all
105 AddChildView(key_image); 105 AddChildView(key_image);
106 106
107 PasswordTextBox* password_text_box = new PasswordTextBox(); 107 PasswordTextBox* password_text_box = new PasswordTextBox();
108 password_text_box->Init(suggestion, password, font_list); 108 password_text_box->Init(suggestion, password, font_list);
109 AddChildView(password_text_box); 109 AddChildView(password_text_box);
110 110
111 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); 111 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true);
112 } 112 }
113 113
114 // views::View: 114 // views::View:
115 virtual bool CanProcessEventsWithinSubtree() const override { 115 bool CanProcessEventsWithinSubtree() const override {
116 // Send events to the parent view for handling. 116 // Send events to the parent view for handling.
117 return false; 117 return false;
118 } 118 }
119 119
120 virtual void GetAccessibleState(ui::AXViewState* state) override { 120 void GetAccessibleState(ui::AXViewState* state) override {
121 state->role = ui::AX_ROLE_ALERT; 121 state->role = ui::AX_ROLE_ALERT;
122 state->name = accessible_name_; 122 state->name = accessible_name_;
123 } 123 }
124 124
125 private: 125 private:
126 base::string16 accessible_name_; 126 base::string16 accessible_name_;
127 127
128 DISALLOW_COPY_AND_ASSIGN(PasswordBox); 128 DISALLOW_COPY_AND_ASSIGN(PasswordBox);
129 }; 129 };
130 130
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 279
280 // If the top level widget can't be found, cancel the popup since we can't 280 // If the top level widget can't be found, cancel the popup since we can't
281 // fully set it up. 281 // fully set it up.
282 if (!observing_widget) 282 if (!observing_widget)
283 return NULL; 283 return NULL;
284 284
285 return new PasswordGenerationPopupViewViews(controller, observing_widget); 285 return new PasswordGenerationPopupViewViews(controller, observing_widget);
286 } 286 }
287 287
288 } // namespace autofill 288 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698