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 #ifndef CHROME_BROWSER_GTK_LOCATION_BAR_VIEW_GTK_H_ |
| 6 #define CHROME_BROWSER_GTK_LOCATION_BAR_VIEW_GTK_H_ |
| 7 |
| 8 #include <gtk/gtk.h> |
| 9 |
| 10 #include <string> |
| 11 |
| 12 #include "base/basictypes.h" |
| 13 #include "chrome/browser/autocomplete/autocomplete_edit.h" |
| 14 #include "chrome/browser/location_bar.h" |
| 15 #include "chrome/common/page_transition_types.h" |
| 16 #include "webkit/glue/window_open_disposition.h" |
| 17 |
| 18 class AutocompleteEditViewGtk; |
| 19 class CommandUpdater; |
| 20 class Profile; |
| 21 class SkBitmap; |
| 22 class TabContents; |
| 23 class ToolbarModel; |
| 24 |
| 25 class LocationBarViewGtk : public AutocompleteEditController, |
| 26 public LocationBar { |
| 27 public: |
| 28 LocationBarViewGtk(CommandUpdater* command_updater, |
| 29 ToolbarModel* toolbar_model); |
| 30 ~LocationBarViewGtk(); |
| 31 |
| 32 void Init(); |
| 33 |
| 34 void SetProfile(Profile* profile); |
| 35 |
| 36 // Return the native vbox widget. You must call Init() first, or the result |
| 37 // will be NULL. This is the widget that an embedder should host. |
| 38 GtkWidget* widget() { return vbox_; } |
| 39 |
| 40 // Updates the location bar. We also reset the bar's permanent text and |
| 41 // security style, and, if |tab_for_state_restoring| is non-NULL, also |
| 42 // restore saved state that the tab holds. |
| 43 void Update(const TabContents* tab_for_state_restoring); |
| 44 |
| 45 // Implement the AutocompleteEditController interface. |
| 46 virtual void OnAutocompleteAccept(const GURL& url, |
| 47 WindowOpenDisposition disposition, |
| 48 PageTransition::Type transition, |
| 49 const GURL& alternate_nav_url); |
| 50 virtual void OnChanged(); |
| 51 virtual void OnInputInProgress(bool in_progress); |
| 52 virtual SkBitmap GetFavIcon() const; |
| 53 virtual std::wstring GetTitle() const; |
| 54 |
| 55 // Implement the LocationBar interface. |
| 56 virtual void ShowFirstRunBubble(); |
| 57 virtual std::wstring GetInputString() const; |
| 58 virtual WindowOpenDisposition GetWindowOpenDisposition() const; |
| 59 virtual PageTransition::Type GetPageTransition() const; |
| 60 virtual void AcceptInput(); |
| 61 virtual void FocusLocation(); |
| 62 virtual void FocusSearch(); |
| 63 virtual void SaveStateToContents(TabContents* contents); |
| 64 |
| 65 private: |
| 66 GtkWidget* vbox_; |
| 67 |
| 68 scoped_ptr<AutocompleteEditViewGtk> edit_view_; |
| 69 |
| 70 Profile* profile_; |
| 71 CommandUpdater* command_updater_; |
| 72 ToolbarModel* toolbar_model_; |
| 73 |
| 74 // When we get an OnAutocompleteAccept notification from the autocomplete |
| 75 // edit, we save the input string so we can give it back to the browser on |
| 76 // the LocationBar interface via GetInputString(). |
| 77 std::wstring location_input_; |
| 78 |
| 79 // The user's desired disposition for how their input should be opened |
| 80 WindowOpenDisposition disposition_; |
| 81 |
| 82 // The transition type to use for the navigation |
| 83 PageTransition::Type transition_; |
| 84 |
| 85 DISALLOW_COPY_AND_ASSIGN(LocationBarViewGtk); |
| 86 }; |
| 87 |
| 88 #endif // CHROME_BROWSER_GTK_LOCATION_BAR_VIEW_GTK_H_ |
OLD | NEW |