OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_UI_GTK_LOCATION_BAR_VIEW_GTK_H_ | 5 #ifndef CHROME_BROWSER_UI_GTK_LOCATION_BAR_VIEW_GTK_H_ |
6 #define CHROME_BROWSER_UI_GTK_LOCATION_BAR_VIEW_GTK_H_ | 6 #define CHROME_BROWSER_UI_GTK_LOCATION_BAR_VIEW_GTK_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
10 | 10 |
(...skipping 23 matching lines...) Expand all Loading... |
34 #include "ui/base/gtk/gtk_signal.h" | 34 #include "ui/base/gtk/gtk_signal.h" |
35 #include "webkit/glue/window_open_disposition.h" | 35 #include "webkit/glue/window_open_disposition.h" |
36 | 36 |
37 class OmniboxViewGtk; | 37 class OmniboxViewGtk; |
38 class Browser; | 38 class Browser; |
39 class CommandUpdater; | 39 class CommandUpdater; |
40 class ContentSettingImageModel; | 40 class ContentSettingImageModel; |
41 class ContentSettingBubbleGtk; | 41 class ContentSettingBubbleGtk; |
42 class ExtensionAction; | 42 class ExtensionAction; |
43 class GtkThemeService; | 43 class GtkThemeService; |
44 class Profile; | |
45 class SkBitmap; | 44 class SkBitmap; |
46 class TabContents; | 45 class TabContents; |
47 class ToolbarModel; | 46 class ToolbarModel; |
48 | 47 |
49 class LocationBarViewGtk : public AutocompleteEditController, | 48 class LocationBarViewGtk : public AutocompleteEditController, |
50 public LocationBar, | 49 public LocationBar, |
51 public LocationBarTesting, | 50 public LocationBarTesting, |
52 public NotificationObserver { | 51 public NotificationObserver { |
53 public: | 52 public: |
54 explicit LocationBarViewGtk(Browser* browser); | 53 explicit LocationBarViewGtk(Browser* browser); |
55 virtual ~LocationBarViewGtk(); | 54 virtual ~LocationBarViewGtk(); |
56 | 55 |
57 void Init(bool popup_window_mode); | 56 void Init(bool popup_window_mode); |
58 | 57 |
59 void SetProfile(Profile* profile); | |
60 | |
61 // Returns the widget the caller should host. You must call Init() first. | 58 // Returns the widget the caller should host. You must call Init() first. |
62 GtkWidget* widget() { return hbox_.get(); } | 59 GtkWidget* widget() { return hbox_.get(); } |
63 | 60 |
64 // Returns the widget the page info bubble should point to. | 61 // Returns the widget the page info bubble should point to. |
65 GtkWidget* location_icon_widget() const { return location_icon_image_; } | 62 GtkWidget* location_icon_widget() const { return location_icon_image_; } |
66 | 63 |
67 // Returns the widget the extension installed bubble should point to. | 64 // Returns the widget the extension installed bubble should point to. |
68 GtkWidget* location_entry_widget() const { return entry_box_; } | 65 GtkWidget* location_entry_widget() const { return entry_box_; } |
69 | 66 |
70 Browser* browser() const { return browser_; } | 67 Browser* browser() const { return browser_; } |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 const NotificationDetails& details); | 139 const NotificationDetails& details); |
143 | 140 |
144 // Edit background color. | 141 // Edit background color. |
145 static const GdkColor kBackgroundColor; | 142 static const GdkColor kBackgroundColor; |
146 | 143 |
147 private: | 144 private: |
148 class ContentSettingImageViewGtk : public BubbleDelegateGtk, | 145 class ContentSettingImageViewGtk : public BubbleDelegateGtk, |
149 public ui::AnimationDelegate { | 146 public ui::AnimationDelegate { |
150 public: | 147 public: |
151 ContentSettingImageViewGtk(ContentSettingsType content_type, | 148 ContentSettingImageViewGtk(ContentSettingsType content_type, |
152 const LocationBarViewGtk* parent, | 149 const LocationBarViewGtk* parent); |
153 Profile* profile); | |
154 virtual ~ContentSettingImageViewGtk(); | 150 virtual ~ContentSettingImageViewGtk(); |
155 | 151 |
156 GtkWidget* widget() { return alignment_.get(); } | 152 GtkWidget* widget() { return alignment_.get(); } |
157 | 153 |
158 void set_profile(Profile* profile) { profile_ = profile; } | |
159 | |
160 bool IsVisible(); | 154 bool IsVisible(); |
161 void UpdateFromTabContents(TabContents* tab_contents); | 155 void UpdateFromTabContents(TabContents* tab_contents); |
162 | 156 |
163 // Overridden from ui::AnimationDelegate: | 157 // Overridden from ui::AnimationDelegate: |
164 virtual void AnimationProgressed(const ui::Animation* animation); | 158 virtual void AnimationProgressed(const ui::Animation* animation); |
165 virtual void AnimationEnded(const ui::Animation* animation); | 159 virtual void AnimationEnded(const ui::Animation* animation); |
166 virtual void AnimationCanceled(const ui::Animation* animation); | 160 virtual void AnimationCanceled(const ui::Animation* animation); |
167 | 161 |
168 private: | 162 private: |
169 // Start the process of showing the label. | 163 // Start the process of showing the label. |
(...skipping 18 matching lines...) Expand all Loading... |
188 OwnedWidgetGtk event_box_; | 182 OwnedWidgetGtk event_box_; |
189 GtkWidget* hbox_; | 183 GtkWidget* hbox_; |
190 OwnedWidgetGtk image_; | 184 OwnedWidgetGtk image_; |
191 | 185 |
192 // Explanatory text ("popup blocked"). | 186 // Explanatory text ("popup blocked"). |
193 OwnedWidgetGtk label_; | 187 OwnedWidgetGtk label_; |
194 | 188 |
195 // The owning LocationBarViewGtk. | 189 // The owning LocationBarViewGtk. |
196 const LocationBarViewGtk* parent_; | 190 const LocationBarViewGtk* parent_; |
197 | 191 |
198 // The currently active profile. | |
199 Profile* profile_; | |
200 | |
201 // The currently shown bubble if any. | 192 // The currently shown bubble if any. |
202 ContentSettingBubbleGtk* content_setting_bubble_; | 193 ContentSettingBubbleGtk* content_setting_bubble_; |
203 | 194 |
204 // When we show explanatory text, we slide it in/out. | 195 // When we show explanatory text, we slide it in/out. |
205 ui::SlideAnimation animation_; | 196 ui::SlideAnimation animation_; |
206 | 197 |
207 // The label's default requisition (cached so we can animate accordingly). | 198 // The label's default requisition (cached so we can animate accordingly). |
208 GtkRequisition label_req_; | 199 GtkRequisition label_req_; |
209 | 200 |
210 ScopedRunnableMethodFactory<ContentSettingImageViewGtk> method_factory_; | 201 ScopedRunnableMethodFactory<ContentSettingImageViewGtk> method_factory_; |
211 | 202 |
212 DISALLOW_COPY_AND_ASSIGN(ContentSettingImageViewGtk); | 203 DISALLOW_COPY_AND_ASSIGN(ContentSettingImageViewGtk); |
213 }; | 204 }; |
214 | 205 |
215 class PageActionViewGtk : public ImageLoadingTracker::Observer, | 206 class PageActionViewGtk : public ImageLoadingTracker::Observer, |
216 public ExtensionContextMenuModel::PopupDelegate { | 207 public ExtensionContextMenuModel::PopupDelegate { |
217 public: | 208 public: |
218 PageActionViewGtk( | 209 PageActionViewGtk(LocationBarViewGtk* owner, ExtensionAction* page_action); |
219 LocationBarViewGtk* owner, Profile* profile, | |
220 ExtensionAction* page_action); | |
221 virtual ~PageActionViewGtk(); | 210 virtual ~PageActionViewGtk(); |
222 | 211 |
223 GtkWidget* widget() { return event_box_.get(); } | 212 GtkWidget* widget() { return event_box_.get(); } |
224 | 213 |
225 ExtensionAction* page_action() { return page_action_; } | 214 ExtensionAction* page_action() { return page_action_; } |
226 | 215 |
227 void set_preview_enabled(bool preview_enabled) { | 216 void set_preview_enabled(bool preview_enabled) { |
228 preview_enabled_ = preview_enabled; | 217 preview_enabled_ = preview_enabled; |
229 } | 218 } |
230 | 219 |
(...skipping 20 matching lines...) Expand all Loading... |
251 bool ShowPopup(bool devtools); | 240 bool ShowPopup(bool devtools); |
252 | 241 |
253 CHROMEGTK_CALLBACK_1(PageActionViewGtk, gboolean, OnButtonPressed, | 242 CHROMEGTK_CALLBACK_1(PageActionViewGtk, gboolean, OnButtonPressed, |
254 GdkEventButton*); | 243 GdkEventButton*); |
255 CHROMEGTK_CALLBACK_1(PageActionViewGtk, gboolean, OnExposeEvent, | 244 CHROMEGTK_CALLBACK_1(PageActionViewGtk, gboolean, OnExposeEvent, |
256 GdkEventExpose*); | 245 GdkEventExpose*); |
257 | 246 |
258 // The location bar view that owns us. | 247 // The location bar view that owns us. |
259 LocationBarViewGtk* owner_; | 248 LocationBarViewGtk* owner_; |
260 | 249 |
261 // The current profile (not owned by us). | |
262 Profile* profile_; | |
263 | |
264 // The PageAction that this view represents. The PageAction is not owned by | 250 // The PageAction that this view represents. The PageAction is not owned by |
265 // us, it resides in the extension of this particular profile. | 251 // us, it resides in the extension of this particular profile. |
266 ExtensionAction* page_action_; | 252 ExtensionAction* page_action_; |
267 | 253 |
268 // A cache of all the different icon paths associated with this page action. | 254 // A cache of all the different icon paths associated with this page action. |
269 typedef std::map<std::string, GdkPixbuf*> PixbufMap; | 255 typedef std::map<std::string, GdkPixbuf*> PixbufMap; |
270 PixbufMap pixbufs_; | 256 PixbufMap pixbufs_; |
271 | 257 |
272 // A cache of the last dynamically generated bitmap and the pixbuf that | 258 // A cache of the last dynamically generated bitmap and the pixbuf that |
273 // corresponds to it. We keep track of both so we can free old pixbufs as | 259 // corresponds to it. We keep track of both so we can free old pixbufs as |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 GtkWidget* tab_to_search_hint_; | 389 GtkWidget* tab_to_search_hint_; |
404 GtkWidget* tab_to_search_hint_leading_label_; | 390 GtkWidget* tab_to_search_hint_leading_label_; |
405 GtkWidget* tab_to_search_hint_icon_; | 391 GtkWidget* tab_to_search_hint_icon_; |
406 GtkWidget* tab_to_search_hint_trailing_label_; | 392 GtkWidget* tab_to_search_hint_trailing_label_; |
407 | 393 |
408 scoped_ptr<OmniboxViewGtk> location_entry_; | 394 scoped_ptr<OmniboxViewGtk> location_entry_; |
409 | 395 |
410 // Alignment used to wrap |location_entry_|. | 396 // Alignment used to wrap |location_entry_|. |
411 GtkWidget* location_entry_alignment_; | 397 GtkWidget* location_entry_alignment_; |
412 | 398 |
413 Profile* profile_; | |
414 CommandUpdater* command_updater_; | 399 CommandUpdater* command_updater_; |
415 ToolbarModel* toolbar_model_; | 400 ToolbarModel* toolbar_model_; |
416 Browser* browser_; | 401 Browser* browser_; |
417 | 402 |
418 // When we get an OnAutocompleteAccept notification from the autocomplete | 403 // When we get an OnAutocompleteAccept notification from the autocomplete |
419 // edit, we save the input string so we can give it back to the browser on | 404 // edit, we save the input string so we can give it back to the browser on |
420 // the LocationBar interface via GetInputString(). | 405 // the LocationBar interface via GetInputString(). |
421 std::wstring location_input_; | 406 std::wstring location_input_; |
422 | 407 |
423 // The user's desired disposition for how their input should be opened. | 408 // The user's desired disposition for how their input should be opened. |
(...skipping 30 matching lines...) Expand all Loading... |
454 // The last search keyword that was shown via the |tab_to_search_box_|. | 439 // The last search keyword that was shown via the |tab_to_search_box_|. |
455 string16 last_keyword_; | 440 string16 last_keyword_; |
456 | 441 |
457 // Used to change the visibility of the star decoration. | 442 // Used to change the visibility of the star decoration. |
458 BooleanPrefMember edit_bookmarks_enabled_; | 443 BooleanPrefMember edit_bookmarks_enabled_; |
459 | 444 |
460 DISALLOW_COPY_AND_ASSIGN(LocationBarViewGtk); | 445 DISALLOW_COPY_AND_ASSIGN(LocationBarViewGtk); |
461 }; | 446 }; |
462 | 447 |
463 #endif // CHROME_BROWSER_UI_GTK_LOCATION_BAR_VIEW_GTK_H_ | 448 #endif // CHROME_BROWSER_UI_GTK_LOCATION_BAR_VIEW_GTK_H_ |
OLD | NEW |