OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #import <Cocoa/Cocoa.h> | |
6 | |
7 #include "base/scoped_ptr.h" | |
8 #include "chrome/browser/autocomplete/autocomplete_edit.h" | |
9 #include "chrome/browser/location_bar.h" | |
10 | |
11 class AutocompleteEditViewMac; | |
12 class CommandUpdater; | |
13 class ToolbarModel; | |
14 | |
15 // A C++ bridge class that represents the location bar UI element to | |
16 // the portable code. Wires up an AutocompleteEditViewMac instance to | |
17 // the location bar text field, which handles most of the work. | |
18 | |
19 class LocationBarViewMac : public AutocompleteEditController, | |
20 public LocationBar { | |
21 public: | |
22 LocationBarViewMac(CommandUpdater* command_updater, | |
23 ToolbarModel* toolbar_model); | |
24 virtual ~LocationBarViewMac(); | |
25 | |
26 void Init(); | |
27 | |
28 void SetField(NSTextField* field); | |
29 | |
30 virtual void ShowFirstRunBubble() { NOTIMPLEMENTED(); } | |
31 virtual std::wstring GetInputString() const; | |
32 virtual WindowOpenDisposition GetWindowOpenDisposition() const; | |
33 virtual PageTransition::Type GetPageTransition() const; | |
34 virtual void AcceptInput() { NOTIMPLEMENTED(); } | |
35 virtual void AcceptInputWithDisposition(WindowOpenDisposition disposition) | |
36 { NOTIMPLEMENTED(); } | |
37 virtual void FocusLocation(); | |
38 virtual void FocusSearch() { NOTIMPLEMENTED(); } | |
39 virtual void UpdateFeedIcon() { /* http://crbug.com/8832 */ } | |
40 virtual void SaveStateToContents(TabContents* contents); | |
41 | |
42 virtual void OnAutocompleteAccept(const GURL& url, | |
43 WindowOpenDisposition disposition, | |
44 PageTransition::Type transition, | |
45 const GURL& alternate_nav_url); | |
46 virtual void OnChanged(); | |
47 virtual void OnInputInProgress(bool in_progress); | |
48 virtual SkBitmap GetFavIcon() const; | |
49 virtual std::wstring GetTitle() const; | |
50 | |
51 private: | |
52 scoped_ptr<AutocompleteEditViewMac> edit_view_; | |
53 | |
54 // TODO(shess): Determine ownership of these. We definitely | |
55 // shouldn't. | |
56 CommandUpdater* command_updater_; // weak | |
57 ToolbarModel* toolbar_model_; // weak | |
58 | |
59 // When we get an OnAutocompleteAccept notification from the autocomplete | |
60 // edit, we save the input string so we can give it back to the browser on | |
61 // the LocationBar interface via GetInputString(). | |
62 std::wstring location_input_; | |
63 | |
64 // The user's desired disposition for how their input should be opened | |
65 WindowOpenDisposition disposition_; | |
66 | |
67 // The transition type to use for the navigation | |
68 PageTransition::Type transition_; | |
69 | |
70 DISALLOW_COPY_AND_ASSIGN(LocationBarViewMac); | |
71 }; | |
OLD | NEW |