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/animation/animation_delegate.h" |
16 #include "ui/gfx/range/range.h" | 16 #include "ui/gfx/range/range.h" |
17 #include "ui/views/controls/textfield/textfield.h" | 17 #include "ui/views/controls/textfield/textfield.h" |
18 #include "ui/views/controls/textfield/textfield_controller.h" | 18 #include "ui/views/controls/textfield/textfield_controller.h" |
19 | 19 |
20 #if defined(OS_CHROMEOS) | 20 #if defined(OS_CHROMEOS) |
21 #include "chromeos/ime/input_method_manager.h" | 21 #include "chromeos/ime/input_method_manager.h" |
22 #endif | 22 #endif |
23 | 23 |
24 class LocationBarView; | 24 class LocationBarView; |
25 class OmniboxPopupView; | 25 class OmniboxPopupView; |
26 class Profile; | 26 class Profile; |
27 | 27 |
28 namespace gfx { | 28 namespace gfx { |
| 29 class RenderText; |
29 class SlideAnimation; | 30 class SlideAnimation; |
30 } | 31 } |
31 | 32 |
32 namespace ui { | 33 namespace ui { |
33 class OSExchangeData; | 34 class OSExchangeData; |
34 } // namespace ui | 35 } // namespace ui |
35 | 36 |
36 // Views-implementation of OmniboxView, based on the gtk implementation. | 37 // Views-implementation of OmniboxView. |
37 class OmniboxViewViews | 38 class OmniboxViewViews |
38 : public OmniboxView, | 39 : public OmniboxView, |
39 public views::Textfield, | 40 public views::Textfield, |
40 public gfx::AnimationDelegate, | 41 public gfx::AnimationDelegate, |
41 #if defined(OS_CHROMEOS) | 42 #if defined(OS_CHROMEOS) |
42 public | 43 public |
43 chromeos::input_method::InputMethodManager::CandidateWindowObserver, | 44 chromeos::input_method::InputMethodManager::CandidateWindowObserver, |
44 #endif | 45 #endif |
45 public views::TextfieldController { | 46 public views::TextfieldController { |
46 public: | 47 public: |
47 // The internal view class name. | 48 // The internal view class name. |
48 static const char kViewClassName[]; | 49 static const char kViewClassName[]; |
49 | 50 |
50 OmniboxViewViews(OmniboxEditController* controller, | 51 OmniboxViewViews(OmniboxEditController* controller, |
51 Profile* profile, | 52 Profile* profile, |
52 CommandUpdater* command_updater, | 53 CommandUpdater* command_updater, |
53 bool popup_window_mode, | 54 bool popup_window_mode, |
54 LocationBarView* location_bar, | 55 LocationBarView* location_bar, |
55 const gfx::FontList& font_list); | 56 const gfx::FontList& font_list); |
56 virtual ~OmniboxViewViews(); | 57 virtual ~OmniboxViewViews(); |
57 | 58 |
58 // Initialize, create the underlying views, etc; | 59 // Initialize, create the underlying views, etc; |
59 void Init(); | 60 void Init(); |
60 | 61 |
61 // Starts an animation that fades in the entire OmniboxView. | 62 // Starts an animation that fades in the entire OmniboxView. |
62 void FadeIn(); | 63 void FadeIn(); |
63 | 64 |
| 65 // Exposes the RenderText for tests. |
| 66 #if defined(UNIT_TEST) |
| 67 gfx::RenderText* GetRenderText() { |
| 68 return views::Textfield::GetRenderText(); |
| 69 } |
| 70 #endif |
| 71 |
64 // View: | 72 // View: |
65 virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) OVERRIDE; | 73 virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) OVERRIDE; |
66 | 74 |
67 // OmniboxView: | 75 // OmniboxView: |
68 virtual void SaveStateToTab(content::WebContents* tab) OVERRIDE; | 76 virtual void SaveStateToTab(content::WebContents* tab) OVERRIDE; |
69 virtual void OnTabChanged(const content::WebContents* web_contents) OVERRIDE; | 77 virtual void OnTabChanged(const content::WebContents* web_contents) OVERRIDE; |
70 virtual void Update() OVERRIDE; | 78 virtual void Update() OVERRIDE; |
71 virtual base::string16 GetText() const OVERRIDE; | 79 virtual base::string16 GetText() const OVERRIDE; |
72 virtual void SetUserText(const base::string16& text, | 80 virtual void SetUserText(const base::string16& text, |
73 const base::string16& display_text, | 81 const base::string16& display_text, |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 // GESTURE_TAP. We want to select all only when the textfield is not in focus | 233 // GESTURE_TAP. We want to select all only when the textfield is not in focus |
226 // and gets a tap. So we use this variable to remember focus state before tap. | 234 // and gets a tap. So we use this variable to remember focus state before tap. |
227 bool select_all_on_gesture_tap_; | 235 bool select_all_on_gesture_tap_; |
228 | 236 |
229 scoped_ptr<gfx::SlideAnimation> fade_in_animation_; | 237 scoped_ptr<gfx::SlideAnimation> fade_in_animation_; |
230 | 238 |
231 DISALLOW_COPY_AND_ASSIGN(OmniboxViewViews); | 239 DISALLOW_COPY_AND_ASSIGN(OmniboxViewViews); |
232 }; | 240 }; |
233 | 241 |
234 #endif // CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_VIEW_VIEWS_H_ | 242 #endif // CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_VIEW_VIEWS_H_ |
OLD | NEW |