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 #include <set> | 9 #include <set> |
10 | 10 |
11 #include "base/memory/scoped_vector.h" | 11 #include "base/memory/scoped_vector.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "base/scoped_observer.h" | 13 #include "base/scoped_observer.h" |
14 #include "chrome/browser/ui/autofill/autofill_dialog_types.h" | 14 #include "chrome/browser/ui/autofill/autofill_dialog_types.h" |
15 #include "chrome/browser/ui/autofill/autofill_dialog_view.h" | 15 #include "chrome/browser/ui/autofill/autofill_dialog_view.h" |
16 #include "chrome/browser/ui/autofill/autofill_dialog_view_delegate.h" | 16 #include "chrome/browser/ui/autofill/autofill_dialog_view_delegate.h" |
17 #include "ui/views/controls/button/button.h" | 17 #include "ui/views/controls/button/button.h" |
18 #include "ui/views/controls/button/menu_button.h" | 18 #include "ui/views/controls/button/menu_button.h" |
19 #include "ui/views/controls/button/menu_button_listener.h" | 19 #include "ui/views/controls/button/menu_button_listener.h" |
20 #include "ui/views/controls/combobox/combobox_listener.h" | 20 #include "ui/views/controls/combobox/combobox_listener.h" |
21 #include "ui/views/controls/link_listener.h" | 21 #include "ui/views/controls/link_listener.h" |
22 #include "ui/views/controls/progress_bar.h" | 22 #include "ui/views/controls/progress_bar.h" |
23 #include "ui/views/controls/scroll_view.h" | 23 #include "ui/views/controls/scroll_view.h" |
24 #include "ui/views/controls/styled_label_listener.h" | 24 #include "ui/views/controls/styled_label_listener.h" |
25 #include "ui/views/controls/textfield/textfield_controller.h" | 25 #include "ui/views/controls/textfield/textfield_controller.h" |
26 #include "ui/views/focus/focus_manager.h" | 26 #include "ui/views/focus/focus_manager.h" |
| 27 #include "ui/views/view_targeter_delegate.h" |
27 #include "ui/views/widget/widget_observer.h" | 28 #include "ui/views/widget/widget_observer.h" |
28 #include "ui/views/window/dialog_delegate.h" | 29 #include "ui/views/window/dialog_delegate.h" |
29 | 30 |
30 namespace gfx { | 31 namespace gfx { |
31 class Image; | 32 class Image; |
32 } | 33 } |
33 | 34 |
34 namespace views { | 35 namespace views { |
35 class BubbleBorder; | 36 class BubbleBorder; |
36 class Checkbox; | 37 class Checkbox; |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 std::vector<DialogNotification> notifications_; | 287 std::vector<DialogNotification> notifications_; |
287 | 288 |
288 DISALLOW_COPY_AND_ASSIGN(NotificationArea); | 289 DISALLOW_COPY_AND_ASSIGN(NotificationArea); |
289 }; | 290 }; |
290 | 291 |
291 typedef std::map<ServerFieldType, ExpandingTextfield*> TextfieldMap; | 292 typedef std::map<ServerFieldType, ExpandingTextfield*> TextfieldMap; |
292 typedef std::map<ServerFieldType, views::Combobox*> ComboboxMap; | 293 typedef std::map<ServerFieldType, views::Combobox*> ComboboxMap; |
293 | 294 |
294 // A view that packs a label on the left and some related controls | 295 // A view that packs a label on the left and some related controls |
295 // on the right. | 296 // on the right. |
296 class SectionContainer : public views::View { | 297 class SectionContainer : public views::View, |
| 298 public views::ViewTargeterDelegate { |
297 public: | 299 public: |
298 SectionContainer(const base::string16& label, | 300 SectionContainer(const base::string16& label, |
299 views::View* controls, | 301 views::View* controls, |
300 views::Button* proxy_button); | 302 views::Button* proxy_button); |
301 virtual ~SectionContainer(); | 303 virtual ~SectionContainer(); |
302 | 304 |
303 // Sets the visual appearance of the section to active (considered active | 305 // Sets the visual appearance of the section to active (considered active |
304 // when showing the menu or hovered by the mouse cursor). | 306 // when showing the menu or hovered by the mouse cursor). |
305 void SetActive(bool active); | 307 void SetActive(bool active); |
306 | 308 |
307 // Sets whether mouse events should be forwarded to |proxy_button_|. | 309 // Sets whether mouse events should be forwarded to |proxy_button_|. |
308 void SetForwardMouseEvents(bool forward); | 310 void SetForwardMouseEvents(bool forward); |
309 | 311 |
310 // views::View implementation. | 312 // views::View implementation. |
311 virtual const char* GetClassName() const OVERRIDE; | 313 virtual const char* GetClassName() const OVERRIDE; |
312 virtual void OnMouseMoved(const ui::MouseEvent& event) OVERRIDE; | 314 virtual void OnMouseMoved(const ui::MouseEvent& event) OVERRIDE; |
313 virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE; | 315 virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE; |
314 virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; | 316 virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; |
315 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; | 317 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; |
316 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; | 318 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; |
317 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; | 319 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; |
318 // This is needed because not all events percolate up the views hierarchy. | |
319 virtual View* GetEventHandlerForRect(const gfx::Rect& rect) OVERRIDE; | |
320 | 320 |
321 private: | 321 private: |
| 322 // views::ViewTargeterDelegate: |
| 323 virtual views::View* TargetForRect(views::View* root, |
| 324 const gfx::Rect& rect) OVERRIDE; |
| 325 |
322 // Converts |event| to one suitable for |proxy_button_|. | 326 // Converts |event| to one suitable for |proxy_button_|. |
323 static ui::MouseEvent ProxyEvent(const ui::MouseEvent& event); | 327 static ui::MouseEvent ProxyEvent(const ui::MouseEvent& event); |
324 | 328 |
325 // Returns true if the given event should be forwarded to |proxy_button_|. | 329 // Returns true if the given event should be forwarded to |proxy_button_|. |
326 bool ShouldForwardEvent(const ui::LocatedEvent& event); | 330 bool ShouldForwardEvent(const ui::LocatedEvent& event); |
327 | 331 |
328 // Mouse events on |this| are sent to this button. | 332 // Mouse events on |this| are sent to this button. |
329 views::Button* proxy_button_; // Weak reference. | 333 views::Button* proxy_button_; // Weak reference. |
330 | 334 |
331 // When true, all mouse events will be forwarded to |proxy_button_|. | 335 // When true, all mouse events will be forwarded to |proxy_button_|. |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 | 682 |
679 // Used to tell the delegate when focus moves to hide the Autofill popup. | 683 // Used to tell the delegate when focus moves to hide the Autofill popup. |
680 scoped_ptr<ui::EventHandler> event_handler_; | 684 scoped_ptr<ui::EventHandler> event_handler_; |
681 | 685 |
682 DISALLOW_COPY_AND_ASSIGN(AutofillDialogViews); | 686 DISALLOW_COPY_AND_ASSIGN(AutofillDialogViews); |
683 }; | 687 }; |
684 | 688 |
685 } // namespace autofill | 689 } // namespace autofill |
686 | 690 |
687 #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_DIALOG_VIEWS_H_ | 691 #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_DIALOG_VIEWS_H_ |
OLD | NEW |