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 // This file defines the interface class OmniboxView. Each toolkit will | 5 // This file defines the interface class OmniboxView. Each toolkit will |
6 // implement the edit view differently, so that code is inherently platform | 6 // implement the edit view differently, so that code is inherently platform |
7 // specific. However, the OmniboxEditModel needs to do some communication with | 7 // specific. However, the OmniboxEditModel needs to do some communication with |
8 // the view. Since the model is shared between platforms, we need to define an | 8 // the view. Since the model is shared between platforms, we need to define an |
9 // interface that all view implementations will share. | 9 // interface that all view implementations will share. |
10 | 10 |
11 #ifndef COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_VIEW_H_ | 11 #ifndef COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_VIEW_H_ |
12 #define COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_VIEW_H_ | 12 #define COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_VIEW_H_ |
13 | 13 |
14 #include <stddef.h> | 14 #include <stddef.h> |
15 | 15 |
16 #include <string> | 16 #include <string> |
17 | 17 |
18 #include "base/gtest_prod_util.h" | 18 #include "base/gtest_prod_util.h" |
19 #include "base/macros.h" | 19 #include "base/macros.h" |
20 #include "base/strings/string16.h" | 20 #include "base/strings/string16.h" |
21 #include "base/strings/string_util.h" | 21 #include "base/strings/string_util.h" |
22 #include "base/strings/utf_string_conversions.h" | 22 #include "base/strings/utf_string_conversions.h" |
23 #include "components/omnibox/browser/autocomplete_match.h" | 23 #include "components/omnibox/browser/autocomplete_match.h" |
24 #include "components/omnibox/browser/omnibox_edit_model.h" | 24 #include "components/omnibox/browser/omnibox_edit_model.h" |
| 25 #include "components/security_state/security_state_model.h" |
25 #include "ui/base/window_open_disposition.h" | 26 #include "ui/base/window_open_disposition.h" |
26 #include "ui/gfx/native_widget_types.h" | 27 #include "ui/gfx/native_widget_types.h" |
27 | 28 |
28 class GURL; | 29 class GURL; |
29 class OmniboxClient; | 30 class OmniboxClient; |
30 class OmniboxEditController; | 31 class OmniboxEditController; |
31 class OmniboxViewMacTest; | 32 class OmniboxViewMacTest; |
32 class ToolbarModel; | 33 class ToolbarModel; |
33 | 34 |
34 namespace gfx { | 35 namespace gfx { |
(...skipping 29 matching lines...) Expand all Loading... |
64 WindowOpenDisposition disposition, | 65 WindowOpenDisposition disposition, |
65 const GURL& alternate_nav_url, | 66 const GURL& alternate_nav_url, |
66 const base::string16& pasted_text, | 67 const base::string16& pasted_text, |
67 size_t selected_line); | 68 size_t selected_line); |
68 | 69 |
69 // Returns the current text of the edit control, which could be the | 70 // Returns the current text of the edit control, which could be the |
70 // "temporary" text set by the popup, the "permanent" text set by the | 71 // "temporary" text set by the popup, the "permanent" text set by the |
71 // browser, or just whatever the user has currently typed. | 72 // browser, or just whatever the user has currently typed. |
72 virtual base::string16 GetText() const = 0; | 73 virtual base::string16 GetText() const = 0; |
73 | 74 |
| 75 // Returns the security level to display in the omnibox. This aligns with the |
| 76 // toolbar model's notion of security but overrides it if the input is |
| 77 // editing or empty. |
| 78 security_state::SecurityStateModel::SecurityLevel GetSecurityLevelForDisplay() |
| 79 const; |
| 80 |
74 // |true| if the user is in the process of editing the field, or if | 81 // |true| if the user is in the process of editing the field, or if |
75 // the field is empty. | 82 // the field is empty. |
76 bool IsEditingOrEmpty() const; | 83 bool IsEditingOrEmpty() const; |
77 | 84 |
78 // Returns the resource ID of the icon to show for the current text. | 85 // Returns the resource ID of the icon to show for the current text. |
79 int GetIcon() const; | 86 int GetIcon() const; |
80 | 87 |
81 // Like GetIcon(), but returns a vector icon identifier. | 88 // Like GetIcon(), but returns a vector icon identifier. |
82 gfx::VectorIconId GetVectorIcon() const; | 89 gfx::VectorIconId GetVectorIcon() const; |
83 | 90 |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ShowURL); | 268 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ShowURL); |
262 | 269 |
263 // |model_| can be NULL in tests. | 270 // |model_| can be NULL in tests. |
264 std::unique_ptr<OmniboxEditModel> model_; | 271 std::unique_ptr<OmniboxEditModel> model_; |
265 OmniboxEditController* controller_; | 272 OmniboxEditController* controller_; |
266 | 273 |
267 DISALLOW_COPY_AND_ASSIGN(OmniboxView); | 274 DISALLOW_COPY_AND_ASSIGN(OmniboxView); |
268 }; | 275 }; |
269 | 276 |
270 #endif // COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_VIEW_H_ | 277 #endif // COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_VIEW_H_ |
OLD | NEW |