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_OMNIBOX_OMNIBOX_VIEW_VIEWS_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_VIEW_VIEWS_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_VIEW_VIEWS_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_VIEW_VIEWS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "chrome/browser/ui/omnibox/omnibox_view.h" | 12 #include "chrome/browser/ui/omnibox/omnibox_view.h" |
13 #include "chrome/browser/ui/toolbar/toolbar_model.h" | 13 #include "chrome/browser/ui/toolbar/toolbar_model.h" |
14 #include "ui/base/window_open_disposition.h" | 14 #include "ui/base/window_open_disposition.h" |
15 #include "ui/gfx/animation/animation_delegate.h" | |
15 #include "ui/gfx/range/range.h" | 16 #include "ui/gfx/range/range.h" |
16 #include "ui/views/controls/textfield/textfield.h" | 17 #include "ui/views/controls/textfield/textfield.h" |
17 #include "ui/views/controls/textfield/textfield_controller.h" | 18 #include "ui/views/controls/textfield/textfield_controller.h" |
18 | 19 |
19 #if defined(OS_CHROMEOS) | 20 #if defined(OS_CHROMEOS) |
20 #include "chromeos/ime/input_method_manager.h" | 21 #include "chromeos/ime/input_method_manager.h" |
21 #endif | 22 #endif |
22 | 23 |
23 class LocationBarView; | 24 class LocationBarView; |
24 class OmniboxPopupView; | 25 class OmniboxPopupView; |
25 class Profile; | 26 class Profile; |
26 | 27 |
28 namespace gfx { | |
29 class SlideAnimation; | |
30 } | |
31 | |
27 namespace ui { | 32 namespace ui { |
28 class OSExchangeData; | 33 class OSExchangeData; |
29 } // namespace ui | 34 } // namespace ui |
30 | 35 |
31 // Views-implementation of OmniboxView, based on the gtk implementation. | 36 // Views-implementation of OmniboxView, based on the gtk implementation. |
32 class OmniboxViewViews | 37 class OmniboxViewViews |
33 : public views::Textfield, | 38 : public views::Textfield, |
34 public OmniboxView, | 39 public OmniboxView, |
40 public gfx::AnimationDelegate, | |
35 #if defined(OS_CHROMEOS) | 41 #if defined(OS_CHROMEOS) |
36 public | 42 public |
37 chromeos::input_method::InputMethodManager::CandidateWindowObserver, | 43 chromeos::input_method::InputMethodManager::CandidateWindowObserver, |
38 #endif | 44 #endif |
39 public views::TextfieldController { | 45 public views::TextfieldController { |
40 public: | 46 public: |
41 // The internal view class name. | 47 // The internal view class name. |
42 static const char kViewClassName[]; | 48 static const char kViewClassName[]; |
43 | 49 |
44 OmniboxViewViews(OmniboxEditController* controller, | 50 OmniboxViewViews(OmniboxEditController* controller, |
45 Profile* profile, | 51 Profile* profile, |
46 CommandUpdater* command_updater, | 52 CommandUpdater* command_updater, |
47 bool popup_window_mode, | 53 bool popup_window_mode, |
48 LocationBarView* location_bar, | 54 LocationBarView* location_bar, |
49 const gfx::FontList& font_list); | 55 const gfx::FontList& font_list); |
50 virtual ~OmniboxViewViews(); | 56 virtual ~OmniboxViewViews(); |
51 | 57 |
52 // Initialize, create the underlying views, etc; | 58 // Initialize, create the underlying views, etc; |
53 void Init(); | 59 void Init(); |
54 | 60 |
61 // Starts an animation that fades in the entire Omnibox. | |
Peter Kasting
2014/03/21 21:22:10
Nit: entire Omnibox -> OmniboxView
("entire omnib
Justin Donnelly
2014/03/24 22:59:37
Done.
| |
62 void FadeIn(); | |
63 | |
64 // gfx::AnimationDelegate:: | |
Peter Kasting
2014/03/21 21:22:10
Nit: List these override sections in the same orde
Justin Donnelly
2014/03/24 22:59:37
Done.
| |
65 virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE; | |
66 virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE; | |
67 | |
55 // views::Textfield: | 68 // views::Textfield: |
56 virtual const char* GetClassName() const OVERRIDE; | 69 virtual const char* GetClassName() const OVERRIDE; |
70 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | |
57 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; | 71 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; |
58 virtual bool OnMouseDragged(const ui::MouseEvent& event) OVERRIDE; | 72 virtual bool OnMouseDragged(const ui::MouseEvent& event) OVERRIDE; |
59 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; | 73 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; |
60 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; | 74 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; |
61 virtual bool OnKeyReleased(const ui::KeyEvent& event) OVERRIDE; | 75 virtual bool OnKeyReleased(const ui::KeyEvent& event) OVERRIDE; |
62 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; | 76 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; |
63 virtual void AboutToRequestFocusFromTabTraversal(bool reverse) OVERRIDE; | 77 virtual void AboutToRequestFocusFromTabTraversal(bool reverse) OVERRIDE; |
64 virtual bool SkipDefaultKeyEventProcessing( | 78 virtual bool SkipDefaultKeyEventProcessing( |
65 const ui::KeyEvent& event) OVERRIDE; | 79 const ui::KeyEvent& event) OVERRIDE; |
66 virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; | 80 virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
197 // We select in response to a click that focuses the omnibox, but we defer | 211 // We select in response to a click that focuses the omnibox, but we defer |
198 // until release, setting this variable back to false if we saw a drag, to | 212 // until release, setting this variable back to false if we saw a drag, to |
199 // allow the user to select just a portion of the text. | 213 // allow the user to select just a portion of the text. |
200 bool select_all_on_mouse_release_; | 214 bool select_all_on_mouse_release_; |
201 | 215 |
202 // Indicates if we want to select all text in the omnibox when we get a | 216 // Indicates if we want to select all text in the omnibox when we get a |
203 // GESTURE_TAP. We want to select all only when the textfield is not in focus | 217 // GESTURE_TAP. We want to select all only when the textfield is not in focus |
204 // and gets a tap. So we use this variable to remember focus state before tap. | 218 // and gets a tap. So we use this variable to remember focus state before tap. |
205 bool select_all_on_gesture_tap_; | 219 bool select_all_on_gesture_tap_; |
206 | 220 |
221 scoped_ptr<gfx::SlideAnimation> fade_in_animation_; | |
222 | |
207 DISALLOW_COPY_AND_ASSIGN(OmniboxViewViews); | 223 DISALLOW_COPY_AND_ASSIGN(OmniboxViewViews); |
208 }; | 224 }; |
209 | 225 |
210 #endif // CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_VIEW_VIEWS_H_ | 226 #endif // CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_VIEW_VIEWS_H_ |
OLD | NEW |