OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_DIALOG_VIEWS_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_DIALOG_VIEWS_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_DIALOG_VIEWS_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_DIALOG_VIEWS_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
246 views::Button* proxy_button); | 246 views::Button* proxy_button); |
247 virtual ~SectionContainer(); | 247 virtual ~SectionContainer(); |
248 | 248 |
249 // Sets the visual appearance of the section to active (considered active | 249 // Sets the visual appearance of the section to active (considered active |
250 // when showing the menu or hovered by the mouse cursor). | 250 // when showing the menu or hovered by the mouse cursor). |
251 void SetActive(bool active); | 251 void SetActive(bool active); |
252 | 252 |
253 // Sets whether mouse events should be forwarded to |proxy_button_|. | 253 // Sets whether mouse events should be forwarded to |proxy_button_|. |
254 void SetForwardMouseEvents(bool forward); | 254 void SetForwardMouseEvents(bool forward); |
255 | 255 |
256 // Refreshes the state of the section container and updates its appearance. | |
257 void Refresh(); | |
258 | |
256 // views::View implementation. | 259 // views::View implementation. |
257 virtual void OnMouseMoved(const ui::MouseEvent& event) OVERRIDE; | 260 virtual void OnMouseMoved(const ui::MouseEvent& event) OVERRIDE; |
258 virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE; | 261 virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE; |
259 virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; | 262 virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; |
260 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; | 263 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; |
261 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; | 264 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; |
262 | 265 |
263 private: | 266 private: |
264 // Converts |event| to one suitable for |proxy_button_|. | 267 // Converts |event| to one suitable for |proxy_button_|. |
265 static ui::MouseEvent ProxyEvent(const ui::MouseEvent& event); | 268 static ui::MouseEvent ProxyEvent(const ui::MouseEvent& event); |
266 | 269 |
267 // Mouse events on |this| are sent to this button. | 270 // Mouse events on |this| are sent to this button. |
268 views::Button* proxy_button_; // Weak reference. | 271 views::Button* proxy_button_; // Weak reference. |
269 | 272 |
270 // When true, mouse events will be forwarded to |proxy_button_|. | 273 // When true, mouse events will be forwarded to |proxy_button_|. |
271 bool forward_mouse_events_; | 274 bool forward_mouse_events_; |
272 | 275 |
276 // Whether this section is currently active. | |
277 bool active_; | |
Evan Stade
2013/03/27 02:39:38
don't need this
Dan Beam
2013/03/27 02:50:36
Done.
| |
278 | |
273 DISALLOW_COPY_AND_ASSIGN(SectionContainer); | 279 DISALLOW_COPY_AND_ASSIGN(SectionContainer); |
274 }; | 280 }; |
275 | 281 |
276 // A view that contains a suggestion (such as a known address) and a link to | 282 // A view that contains a suggestion (such as a known address) and a link to |
277 // edit the suggestion. | 283 // edit the suggestion. |
278 class SuggestionView : public views::View { | 284 class SuggestionView : public views::View { |
279 public: | 285 public: |
280 SuggestionView(const string16& edit_label, | 286 SuggestionView(const string16& edit_label, |
281 AutofillDialogViews* autofill_dialog); | 287 AutofillDialogViews* autofill_dialog); |
282 virtual ~SuggestionView(); | 288 virtual ~SuggestionView(); |
283 | 289 |
290 // Whether this section is editable or not. | |
291 void SetEditable(bool editable); | |
292 | |
284 // Sets the display text of the suggestion. | 293 // Sets the display text of the suggestion. |
285 void SetSuggestionText(const string16& text); | 294 void SetSuggestionText(const string16& text); |
286 | 295 |
287 // Sets the icon which should be displayed ahead of the text. | 296 // Sets the icon which should be displayed ahead of the text. |
288 void SetSuggestionIcon(const gfx::Image& image); | 297 void SetSuggestionIcon(const gfx::Image& image); |
289 | 298 |
290 // Shows an auxiliary textfield to the right of the suggestion icon and | 299 // Shows an auxiliary textfield to the right of the suggestion icon and |
291 // text. This is currently only used to show a CVC field for the CC section. | 300 // text. This is currently only used to show a CVC field for the CC section. |
292 void ShowTextfield(const string16& placeholder_text, | 301 void ShowTextfield(const string16& placeholder_text, |
293 const gfx::ImageSkia& icon); | 302 const gfx::ImageSkia& icon); |
294 | 303 |
295 DecoratedTextfield* decorated_textfield() { return decorated_; } | 304 DecoratedTextfield* decorated_textfield() { return decorated_; } |
296 | 305 |
297 private: | 306 private: |
298 // The label that holds the suggestion description text. | 307 // The label that holds the suggestion description text. |
299 views::Label* label_; | 308 views::Label* label_; |
300 // The second (and greater) line of text that describes the suggestion. | 309 // The second (and greater) line of text that describes the suggestion. |
301 views::Label* label_line_2_; | 310 views::Label* label_line_2_; |
302 // The icon that comes just before |label_|. | 311 // The icon that comes just before |label_|. |
303 views::ImageView* icon_; | 312 views::ImageView* icon_; |
304 // A view to contain |label_| and |icon_|. | 313 // A view to contain |label_| and |icon_|. |
305 views::View* label_container_; | 314 views::View* label_container_; |
306 // The input set by ShowTextfield. | 315 // The input set by ShowTextfield. |
307 DecoratedTextfield* decorated_; | 316 DecoratedTextfield* decorated_; |
317 // An "Edit" link that flips to editable inputs rather than suggestion text. | |
318 views::Link* edit_link_; | |
308 | 319 |
309 DISALLOW_COPY_AND_ASSIGN(SuggestionView); | 320 DISALLOW_COPY_AND_ASSIGN(SuggestionView); |
310 }; | 321 }; |
311 | 322 |
312 // A convenience struct for holding pointers to views within each detail | 323 // A convenience struct for holding pointers to views within each detail |
313 // section. None of the member pointers are owned. | 324 // section. None of the member pointers are owned. |
314 struct DetailsGroup { | 325 struct DetailsGroup { |
315 explicit DetailsGroup(DialogSection section); | 326 explicit DetailsGroup(DialogSection section); |
316 ~DetailsGroup(); | 327 ~DetailsGroup(); |
317 | 328 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
462 | 473 |
463 // The focus manager for |window_|. | 474 // The focus manager for |window_|. |
464 views::FocusManager* focus_manager_; | 475 views::FocusManager* focus_manager_; |
465 | 476 |
466 DISALLOW_COPY_AND_ASSIGN(AutofillDialogViews); | 477 DISALLOW_COPY_AND_ASSIGN(AutofillDialogViews); |
467 }; | 478 }; |
468 | 479 |
469 } // namespace autofill | 480 } // namespace autofill |
470 | 481 |
471 #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_DIALOG_VIEWS_H_ | 482 #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_DIALOG_VIEWS_H_ |
OLD | NEW |