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 <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 #include <set> | 11 #include <set> |
12 #include <string> | 12 #include <string> |
13 | 13 |
14 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "build/build_config.h" | 16 #include "build/build_config.h" |
17 #include "components/omnibox/browser/omnibox_view.h" | 17 #include "components/omnibox/browser/omnibox_view.h" |
18 #include "components/security_state/core/security_state.h" | 18 #include "components/security_state/core/security_state.h" |
19 #include "ui/base/window_open_disposition.h" | 19 #include "ui/base/window_open_disposition.h" |
20 #include "ui/gfx/range/range.h" | 20 #include "ui/gfx/range/range.h" |
21 #include "ui/views/controls/textfield/textfield.h" | 21 #include "ui/views/controls/textfield/textfield.h" |
22 #include "ui/views/controls/textfield/textfield_controller.h" | 22 #include "ui/views/controls/textfield/textfield_controller.h" |
23 | 23 |
24 #if defined(OS_CHROMEOS) | 24 #if defined(OS_CHROMEOS) |
25 #include "ui/base/ime/chromeos/input_method_manager.h" | 25 #include "ui/base/ime/chromeos/input_method_manager.h" |
26 #endif | 26 #endif |
27 | 27 |
28 class CommandUpdater; | 28 class CommandUpdater; |
29 class LocationBarView; | 29 class LocationBarView; |
| 30 class OmniboxClient; |
30 class OmniboxPopupView; | 31 class OmniboxPopupView; |
31 class Profile; | |
32 | 32 |
33 namespace content { | 33 namespace content { |
34 class WebContents; | 34 class WebContents; |
35 } // namespace content | 35 } // namespace content |
36 | 36 |
37 namespace gfx { | 37 namespace gfx { |
38 class RenderText; | 38 class RenderText; |
39 } | 39 } |
40 | 40 |
41 namespace ui { | 41 namespace ui { |
42 class OSExchangeData; | 42 class OSExchangeData; |
43 } // namespace ui | 43 } // namespace ui |
44 | 44 |
45 // Views-implementation of OmniboxView. | 45 // Views-implementation of OmniboxView. |
46 class OmniboxViewViews | 46 class OmniboxViewViews |
47 : public OmniboxView, | 47 : public OmniboxView, |
48 public views::Textfield, | 48 public views::Textfield, |
49 #if defined(OS_CHROMEOS) | 49 #if defined(OS_CHROMEOS) |
50 public | 50 public |
51 chromeos::input_method::InputMethodManager::CandidateWindowObserver, | 51 chromeos::input_method::InputMethodManager::CandidateWindowObserver, |
52 #endif | 52 #endif |
53 public views::TextfieldController { | 53 public views::TextfieldController { |
54 public: | 54 public: |
55 // The internal view class name. | 55 // The internal view class name. |
56 static const char kViewClassName[]; | 56 static const char kViewClassName[]; |
57 | 57 |
58 OmniboxViewViews(OmniboxEditController* controller, | 58 OmniboxViewViews(OmniboxEditController* controller, |
59 Profile* profile, | 59 std::unique_ptr<OmniboxClient> client, |
60 CommandUpdater* command_updater, | 60 CommandUpdater* command_updater, |
61 bool popup_window_mode, | 61 bool popup_window_mode, |
62 LocationBarView* location_bar, | 62 LocationBarView* location_bar, |
63 const gfx::FontList& font_list); | 63 const gfx::FontList& font_list); |
64 ~OmniboxViewViews() override; | 64 ~OmniboxViewViews() override; |
65 | 65 |
66 // Initialize, create the underlying views, etc. | 66 // Initialize, create the underlying views, etc. |
67 void Init(); | 67 void Init(); |
68 | 68 |
69 // Exposes the RenderText for tests. | 69 // Exposes the RenderText for tests. |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 void OnAfterUserAction(views::Textfield* sender) override; | 193 void OnAfterUserAction(views::Textfield* sender) override; |
194 void OnAfterCutOrCopy(ui::ClipboardType clipboard_type) override; | 194 void OnAfterCutOrCopy(ui::ClipboardType clipboard_type) override; |
195 void OnWriteDragData(ui::OSExchangeData* data) override; | 195 void OnWriteDragData(ui::OSExchangeData* data) override; |
196 void OnGetDragOperationsForTextfield(int* drag_operations) override; | 196 void OnGetDragOperationsForTextfield(int* drag_operations) override; |
197 void AppendDropFormats( | 197 void AppendDropFormats( |
198 int* formats, | 198 int* formats, |
199 std::set<ui::Clipboard::FormatType>* format_types) override; | 199 std::set<ui::Clipboard::FormatType>* format_types) override; |
200 int OnDrop(const ui::OSExchangeData& data) override; | 200 int OnDrop(const ui::OSExchangeData& data) override; |
201 void UpdateContextMenu(ui::SimpleMenuModel* menu_contents) override; | 201 void UpdateContextMenu(ui::SimpleMenuModel* menu_contents) override; |
202 | 202 |
203 Profile* profile_; | |
204 | |
205 // When true, the location bar view is read only and also is has a slightly | 203 // When true, the location bar view is read only and also is has a slightly |
206 // different presentation (smaller font size). This is used for popups. | 204 // different presentation (smaller font size). This is used for popups. |
207 bool popup_window_mode_; | 205 bool popup_window_mode_; |
208 | 206 |
209 std::unique_ptr<OmniboxPopupView> popup_view_; | 207 std::unique_ptr<OmniboxPopupView> popup_view_; |
210 | 208 |
211 security_state::SecurityLevel security_level_; | 209 security_state::SecurityLevel security_level_; |
212 | 210 |
213 // Selection persisted across temporary text changes, like popup suggestions. | 211 // Selection persisted across temporary text changes, like popup suggestions. |
214 gfx::Range saved_temporary_selection_; | 212 gfx::Range saved_temporary_selection_; |
(...skipping 29 matching lines...) Expand all Loading... |
244 bool select_all_on_gesture_tap_; | 242 bool select_all_on_gesture_tap_; |
245 | 243 |
246 // The time of the first character insert operation that has not yet been | 244 // The time of the first character insert operation that has not yet been |
247 // painted. Used to measure omnibox responsiveness with a histogram. | 245 // painted. Used to measure omnibox responsiveness with a histogram. |
248 base::TimeTicks insert_char_time_; | 246 base::TimeTicks insert_char_time_; |
249 | 247 |
250 DISALLOW_COPY_AND_ASSIGN(OmniboxViewViews); | 248 DISALLOW_COPY_AND_ASSIGN(OmniboxViewViews); |
251 }; | 249 }; |
252 | 250 |
253 #endif // CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_VIEW_VIEWS_H_ | 251 #endif // CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_VIEW_VIEWS_H_ |
OLD | NEW |