OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 COMPONENTS_TOOLBAR_TOOLBAR_MODEL_H_ | 5 #ifndef COMPONENTS_TOOLBAR_TOOLBAR_MODEL_H_ |
6 #define COMPONENTS_TOOLBAR_TOOLBAR_MODEL_H_ | 6 #define COMPONENTS_TOOLBAR_TOOLBAR_MODEL_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
14 #include "components/security_state/security_state_model.h" | 14 #include "components/security_state/security_state_model.h" |
15 #include "url/gurl.h" | 15 #include "url/gurl.h" |
16 | 16 |
17 namespace gfx { | 17 namespace gfx { |
18 enum class VectorIconId; | 18 enum class VectorIconId; |
19 } | 19 } |
20 | 20 |
21 // This class is the model used by the toolbar, location bar and autocomplete | 21 // This class is the model used by the toolbar, location bar and autocomplete |
22 // edit. It populates its states from the current navigation entry retrieved | 22 // edit. It populates its states from the current navigation entry retrieved |
23 // from the navigation controller returned by GetNavigationController(). | 23 // from the navigation controller returned by GetNavigationController(). |
24 class ToolbarModel { | 24 class ToolbarModel { |
25 public: | 25 public: |
26 virtual ~ToolbarModel(); | 26 virtual ~ToolbarModel() = default; |
27 | 27 |
28 // Returns a formatted URL for display in the toolbar. The formatting | 28 // Returns a formatted URL for display in the toolbar. The formatting |
29 // includes: | 29 // includes: |
30 // - Some characters may be unescaped. | 30 // - Some characters may be unescaped. |
31 // - The scheme and/or trailing slash may be dropped. | 31 // - The scheme and/or trailing slash may be dropped. |
32 // If |prefix_end| is non-NULL, it is set to the length of the pre-hostname | 32 // If |prefix_end| is non-NULL, it is set to the length of the pre-hostname |
33 // portion of the resulting URL. | 33 // portion of the resulting URL. |
34 virtual base::string16 GetFormattedURL(size_t* prefix_end) const = 0; | 34 virtual base::string16 GetFormattedURL(size_t* prefix_end) const = 0; |
35 | 35 |
36 // Returns the URL of the current navigation entry. | 36 // Returns the URL of the current navigation entry. |
(...skipping 25 matching lines...) Expand all Loading... |
62 // Returns whether the URL for the current navigation entry should be | 62 // Returns whether the URL for the current navigation entry should be |
63 // in the location bar. | 63 // in the location bar. |
64 virtual bool ShouldDisplayURL() const = 0; | 64 virtual bool ShouldDisplayURL() const = 0; |
65 | 65 |
66 // Whether the text in the omnibox is currently being edited. | 66 // Whether the text in the omnibox is currently being edited. |
67 void set_input_in_progress(bool input_in_progress) { | 67 void set_input_in_progress(bool input_in_progress) { |
68 input_in_progress_ = input_in_progress; | 68 input_in_progress_ = input_in_progress; |
69 } | 69 } |
70 bool input_in_progress() const { return input_in_progress_; } | 70 bool input_in_progress() const { return input_in_progress_; } |
71 | 71 |
72 // Whether URL replacement should be enabled. | |
73 // TODO(treib,pkasting): Remove this. crbug.com/627747 | |
74 void set_url_replacement_enabled(bool enabled) { | |
75 url_replacement_enabled_ = enabled; | |
76 } | |
77 bool url_replacement_enabled() const { | |
78 return url_replacement_enabled_; | |
79 } | |
80 | |
81 protected: | 72 protected: |
82 ToolbarModel(); | 73 ToolbarModel() : input_in_progress_(false) {} |
83 | 74 |
84 private: | 75 private: |
85 bool input_in_progress_; | 76 bool input_in_progress_; |
86 bool url_replacement_enabled_; | |
87 | 77 |
88 DISALLOW_COPY_AND_ASSIGN(ToolbarModel); | 78 DISALLOW_COPY_AND_ASSIGN(ToolbarModel); |
89 }; | 79 }; |
90 | 80 |
91 #endif // COMPONENTS_TOOLBAR_TOOLBAR_MODEL_H_ | 81 #endif // COMPONENTS_TOOLBAR_TOOLBAR_MODEL_H_ |
OLD | NEW |