Chromium Code Reviews| 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 // Returns the RenderText that is used by view::TextField. | |
| 66 gfx::RenderText* GetRenderTextForTesting(); | |
|
Peter Kasting
2014/05/06 21:28:33
Can we instead bracket this with #if defined(UNIT_
Daniel Erat
2014/05/07 18:43:02
thanks, i didn't know about this #define. done.
| |
| 67 | |
| 64 // View: | 68 // View: |
| 65 virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) OVERRIDE; | 69 virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) OVERRIDE; |
| 66 | 70 |
| 67 // OmniboxView: | 71 // OmniboxView: |
| 68 virtual void SaveStateToTab(content::WebContents* tab) OVERRIDE; | 72 virtual void SaveStateToTab(content::WebContents* tab) OVERRIDE; |
| 69 virtual void OnTabChanged(const content::WebContents* web_contents) OVERRIDE; | 73 virtual void OnTabChanged(const content::WebContents* web_contents) OVERRIDE; |
| 70 virtual void Update() OVERRIDE; | 74 virtual void Update() OVERRIDE; |
| 71 virtual base::string16 GetText() const OVERRIDE; | 75 virtual base::string16 GetText() const OVERRIDE; |
| 72 virtual void SetUserText(const base::string16& text, | 76 virtual void SetUserText(const base::string16& text, |
| 73 const base::string16& display_text, | 77 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 | 229 // 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. | 230 // and gets a tap. So we use this variable to remember focus state before tap. |
| 227 bool select_all_on_gesture_tap_; | 231 bool select_all_on_gesture_tap_; |
| 228 | 232 |
| 229 scoped_ptr<gfx::SlideAnimation> fade_in_animation_; | 233 scoped_ptr<gfx::SlideAnimation> fade_in_animation_; |
| 230 | 234 |
| 231 DISALLOW_COPY_AND_ASSIGN(OmniboxViewViews); | 235 DISALLOW_COPY_AND_ASSIGN(OmniboxViewViews); |
| 232 }; | 236 }; |
| 233 | 237 |
| 234 #endif // CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_VIEW_VIEWS_H_ | 238 #endif // CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_VIEW_VIEWS_H_ |
| OLD | NEW |