OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 // The LocationBar class is a virtual interface, defining access to the |
| 6 // window's location bar component. This class exists so that cross-platform |
| 7 // components like the browser command system can talk to the platform |
| 8 // specific implementations of the location bar control. It also allows the |
| 9 // location bar to be mocked for testing. |
| 10 |
5 #ifndef CHROME_BROWSER_LOCATION_BAR_H_ | 11 #ifndef CHROME_BROWSER_LOCATION_BAR_H_ |
6 #define CHROME_BROWSER_LOCATION_BAR_H_ | 12 #define CHROME_BROWSER_LOCATION_BAR_H_ |
7 | 13 |
| 14 #include <string> |
| 15 |
8 #include "chrome/common/page_transition_types.h" | 16 #include "chrome/common/page_transition_types.h" |
9 #include "webkit/glue/window_open_disposition.h" | 17 #include "webkit/glue/window_open_disposition.h" |
10 | 18 |
11 //////////////////////////////////////////////////////////////////////////////// | 19 class TabContents; |
12 // LocationBar | 20 |
13 // An interface providing access to the Location Bar component of the browser | |
14 // window. | |
15 // | |
16 class LocationBar { | 21 class LocationBar { |
17 public: | 22 public: |
18 // Shows the first run information bubble anchored to the location bar. | 23 // Shows the first run information bubble anchored to the location bar. |
19 virtual void ShowFirstRunBubble() = 0; | 24 virtual void ShowFirstRunBubble() = 0; |
20 | 25 |
21 // Returns the string of text entered in the location bar. | 26 // Returns the string of text entered in the location bar. |
22 virtual std::wstring GetInputString() const = 0; | 27 virtual std::wstring GetInputString() const = 0; |
23 | 28 |
24 // Returns the WindowOpenDisposition that should be used to determine where to | 29 // Returns the WindowOpenDisposition that should be used to determine where |
25 // open a URL entered in the location bar. | 30 // to open a URL entered in the location bar. |
26 virtual WindowOpenDisposition GetWindowOpenDisposition() const = 0; | 31 virtual WindowOpenDisposition GetWindowOpenDisposition() const = 0; |
27 | 32 |
28 // Returns the PageTransition that should be recorded in history when the URL | 33 // Returns the PageTransition that should be recorded in history when the URL |
29 // entered in the location bar is loaded. | 34 // entered in the location bar is loaded. |
30 virtual PageTransition::Type GetPageTransition() const = 0; | 35 virtual PageTransition::Type GetPageTransition() const = 0; |
31 | 36 |
32 // Accepts the current string of text entered in the location bar. | 37 // Accepts the current string of text entered in the location bar. |
33 virtual void AcceptInput() = 0; | 38 virtual void AcceptInput() = 0; |
34 | 39 |
35 // Focuses and selects the contents of the location bar. | 40 // Focuses and selects the contents of the location bar. |
36 virtual void FocusLocation() = 0; | 41 virtual void FocusLocation() = 0; |
37 | 42 |
38 // Clears the location bar, inserts an annoying little "?" turd and sets focus | 43 // Clears the location bar, inserts an annoying little "?" turd and sets |
39 // to it. | 44 // focus to it. |
40 virtual void FocusSearch() = 0; | 45 virtual void FocusSearch() = 0; |
41 | 46 |
42 // Saves the state of the location bar to the specified TabContents, so that | 47 // Saves the state of the location bar to the specified TabContents, so that |
43 // it can be restored later. (Done when switching tabs). | 48 // it can be restored later. (Done when switching tabs). |
44 virtual void SaveStateToContents(TabContents* contents) = 0; | 49 virtual void SaveStateToContents(TabContents* contents) = 0; |
45 }; | 50 }; |
46 | 51 |
47 #endif // #ifndef CHROME_BROWSER_LOCATION_BAR_H_ | 52 #endif // CHROME_BROWSER_LOCATION_BAR_H_ |
OLD | NEW |