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_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/task.h" | 13 #include "base/task.h" |
14 #include "chrome/browser/autocomplete/autocomplete_edit.h" | 14 #include "chrome/browser/autocomplete/autocomplete_edit.h" |
15 #include "chrome/browser/extensions/extension_context_menu_model.h" | 15 #include "chrome/browser/extensions/extension_context_menu_model.h" |
16 #include "chrome/browser/first_run/first_run.h" | 16 #include "chrome/browser/first_run/first_run.h" |
| 17 #include "chrome/browser/prefs/pref_member.h" |
17 #include "chrome/browser/search_engines/template_url_model_observer.h" | 18 #include "chrome/browser/search_engines/template_url_model_observer.h" |
18 #include "chrome/browser/ui/omnibox/location_bar.h" | 19 #include "chrome/browser/ui/omnibox/location_bar.h" |
19 #include "chrome/browser/ui/toolbar/toolbar_model.h" | 20 #include "chrome/browser/ui/toolbar/toolbar_model.h" |
20 #include "chrome/browser/ui/views/extensions/extension_popup.h" | 21 #include "chrome/browser/ui/views/extensions/extension_popup.h" |
21 #include "ui/gfx/font.h" | 22 #include "ui/gfx/font.h" |
22 #include "ui/gfx/rect.h" | 23 #include "ui/gfx/rect.h" |
23 #include "views/controls/native/native_view_host.h" | 24 #include "views/controls/native/native_view_host.h" |
24 | 25 |
25 #if defined(OS_WIN) | 26 #if defined(OS_WIN) |
26 #include "chrome/browser/autocomplete/autocomplete_edit_view_win.h" | 27 #include "chrome/browser/autocomplete/autocomplete_edit_view_win.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 // | 60 // |
60 // The LocationBarView class is a View subclass that paints the background | 61 // The LocationBarView class is a View subclass that paints the background |
61 // of the URL bar strip and contains its content. | 62 // of the URL bar strip and contains its content. |
62 // | 63 // |
63 ///////////////////////////////////////////////////////////////////////////// | 64 ///////////////////////////////////////////////////////////////////////////// |
64 class LocationBarView : public LocationBar, | 65 class LocationBarView : public LocationBar, |
65 public LocationBarTesting, | 66 public LocationBarTesting, |
66 public views::View, | 67 public views::View, |
67 public views::DragController, | 68 public views::DragController, |
68 public AutocompleteEditController, | 69 public AutocompleteEditController, |
69 public TemplateURLModelObserver { | 70 public TemplateURLModelObserver, |
| 71 public NotificationObserver { |
70 public: | 72 public: |
71 // The location bar view's class name. | 73 // The location bar view's class name. |
72 static const char kViewClassName[]; | 74 static const char kViewClassName[]; |
73 | 75 |
74 class Delegate { | 76 class Delegate { |
75 public: | 77 public: |
76 // Should return the current tab contents. | 78 // Should return the current tab contents. |
77 virtual TabContentsWrapper* GetTabContentsWrapper() const = 0; | 79 virtual TabContentsWrapper* GetTabContentsWrapper() const = 0; |
78 | 80 |
79 // Returns the InstantController, or NULL if there isn't one. | 81 // Returns the InstantController, or NULL if there isn't one. |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 // Overridden from LocationBarTesting: | 247 // Overridden from LocationBarTesting: |
246 virtual int PageActionCount() OVERRIDE; | 248 virtual int PageActionCount() OVERRIDE; |
247 virtual int PageActionVisibleCount() OVERRIDE; | 249 virtual int PageActionVisibleCount() OVERRIDE; |
248 virtual ExtensionAction* GetPageAction(size_t index) OVERRIDE; | 250 virtual ExtensionAction* GetPageAction(size_t index) OVERRIDE; |
249 virtual ExtensionAction* GetVisiblePageAction(size_t index) OVERRIDE; | 251 virtual ExtensionAction* GetVisiblePageAction(size_t index) OVERRIDE; |
250 virtual void TestPageActionPressed(size_t index) OVERRIDE; | 252 virtual void TestPageActionPressed(size_t index) OVERRIDE; |
251 | 253 |
252 // Overridden from TemplateURLModelObserver | 254 // Overridden from TemplateURLModelObserver |
253 virtual void OnTemplateURLModelChanged() OVERRIDE; | 255 virtual void OnTemplateURLModelChanged() OVERRIDE; |
254 | 256 |
| 257 // Overridden from NotificationObserver |
| 258 virtual void Observe(NotificationType type, |
| 259 const NotificationSource& source, |
| 260 const NotificationDetails& details) OVERRIDE; |
| 261 |
255 // Thickness of the left and right edges of the omnibox, in normal mode. | 262 // Thickness of the left and right edges of the omnibox, in normal mode. |
256 static const int kNormalHorizontalEdgeThickness; | 263 static const int kNormalHorizontalEdgeThickness; |
257 // Thickness of the top and bottom edges of the omnibox. | 264 // Thickness of the top and bottom edges of the omnibox. |
258 static const int kVerticalEdgeThickness; | 265 static const int kVerticalEdgeThickness; |
259 // Space between items in the location bar. | 266 // Space between items in the location bar. |
260 static const int kItemPadding; | 267 static const int kItemPadding; |
261 // Space between items in the location bar when an extension keyword is | 268 // Space between items in the location bar when an extension keyword is |
262 // showing. | 269 // showing. |
263 static const int kExtensionItemPadding; | 270 static const int kExtensionItemPadding; |
264 // Space between the edges and the items next to them. | 271 // Space between the edges and the items next to them. |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 bool show_focus_rect_; | 403 bool show_focus_rect_; |
397 | 404 |
398 // Whether bubble text is short or long. | 405 // Whether bubble text is short or long. |
399 FirstRun::BubbleType bubble_type_; | 406 FirstRun::BubbleType bubble_type_; |
400 | 407 |
401 // This is in case we're destroyed before the model loads. We store the model | 408 // This is in case we're destroyed before the model loads. We store the model |
402 // because calling profile_->GetTemplateURLModel() in the destructor causes a | 409 // because calling profile_->GetTemplateURLModel() in the destructor causes a |
403 // crash. | 410 // crash. |
404 TemplateURLModel* template_url_model_; | 411 TemplateURLModel* template_url_model_; |
405 | 412 |
| 413 // Tracks this preference to determine whether bookmark editing is allowed. |
| 414 BooleanPrefMember edit_bookmarks_enabled_; |
| 415 |
406 DISALLOW_IMPLICIT_CONSTRUCTORS(LocationBarView); | 416 DISALLOW_IMPLICIT_CONSTRUCTORS(LocationBarView); |
407 }; | 417 }; |
408 | 418 |
409 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_ | 419 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_ |
OLD | NEW |