Chromium Code Reviews| 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/prefs/pref_member.h" |
| 18 #include "chrome/browser/search_engines/template_url_model_observer.h" | 18 #include "chrome/browser/search_engines/template_url_model_observer.h" |
| 19 #include "chrome/browser/ui/omnibox/location_bar.h" | 19 #include "chrome/browser/ui/omnibox/location_bar.h" |
| 20 #include "chrome/browser/ui/toolbar/toolbar_model.h" | 20 #include "chrome/browser/ui/toolbar/toolbar_model.h" |
| 21 #include "chrome/browser/ui/views/dropdown_bar_host.h" | |
| 21 #include "chrome/browser/ui/views/extensions/extension_popup.h" | 22 #include "chrome/browser/ui/views/extensions/extension_popup.h" |
| 22 #include "ui/gfx/font.h" | 23 #include "ui/gfx/font.h" |
| 23 #include "ui/gfx/rect.h" | 24 #include "ui/gfx/rect.h" |
| 24 #include "views/controls/native/native_view_host.h" | 25 #include "views/controls/native/native_view_host.h" |
| 25 | 26 |
| 26 #if defined(OS_WIN) | 27 #if defined(OS_WIN) |
| 27 #include "chrome/browser/ui/views/omnibox/omnibox_view_win.h" | 28 #include "chrome/browser/ui/views/omnibox/omnibox_view_win.h" |
| 28 #elif defined(OS_LINUX) | 29 #elif defined(OS_LINUX) |
| 29 #include "chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.h" | 30 #include "chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.h" |
| 30 #endif | 31 #endif |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 60 // | 61 // |
| 61 // The LocationBarView class is a View subclass that paints the background | 62 // The LocationBarView class is a View subclass that paints the background |
| 62 // of the URL bar strip and contains its content. | 63 // of the URL bar strip and contains its content. |
| 63 // | 64 // |
| 64 ///////////////////////////////////////////////////////////////////////////// | 65 ///////////////////////////////////////////////////////////////////////////// |
| 65 class LocationBarView : public LocationBar, | 66 class LocationBarView : public LocationBar, |
| 66 public LocationBarTesting, | 67 public LocationBarTesting, |
| 67 public views::View, | 68 public views::View, |
| 68 public views::DragController, | 69 public views::DragController, |
| 69 public AutocompleteEditController, | 70 public AutocompleteEditController, |
| 71 public DropdownBarHost::Delegate, | |
| 70 public TemplateURLModelObserver, | 72 public TemplateURLModelObserver, |
| 71 public NotificationObserver { | 73 public NotificationObserver { |
| 72 public: | 74 public: |
| 73 // The location bar view's class name. | 75 // The location bar view's class name. |
| 74 static const char kViewClassName[]; | 76 static const char kViewClassName[]; |
| 75 | 77 |
| 78 // DropdownBarHost::Delegate | |
| 79 virtual void set_animation_offset(int offset) OVERRIDE; | |
| 80 virtual void SetFocusAndSelection(bool select_all) OVERRIDE; | |
| 81 | |
| 82 // Returns the offset used while animating. | |
| 83 int animation_offset() const { return animation_offset_; } | |
| 84 | |
| 76 class Delegate { | 85 class Delegate { |
| 77 public: | 86 public: |
| 78 // Should return the current tab contents. | 87 // Should return the current tab contents. |
| 79 virtual TabContentsWrapper* GetTabContentsWrapper() const = 0; | 88 virtual TabContentsWrapper* GetTabContentsWrapper() const = 0; |
| 80 | 89 |
| 81 // Returns the InstantController, or NULL if there isn't one. | 90 // Returns the InstantController, or NULL if there isn't one. |
| 82 virtual InstantController* GetInstant() = 0; | 91 virtual InstantController* GetInstant() = 0; |
| 83 | 92 |
| 84 // Called by the location bar view when the user starts typing in the edit. | 93 // Called by the location bar view when the user starts typing in the edit. |
| 85 // This forces our security style to be UNKNOWN for the duration of the | 94 // This forces our security style to be UNKNOWN for the duration of the |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 405 FirstRun::BubbleType bubble_type_; | 414 FirstRun::BubbleType bubble_type_; |
| 406 | 415 |
| 407 // This is in case we're destroyed before the model loads. We store the model | 416 // This is in case we're destroyed before the model loads. We store the model |
| 408 // because calling profile_->GetTemplateURLModel() in the destructor causes a | 417 // because calling profile_->GetTemplateURLModel() in the destructor causes a |
| 409 // crash. | 418 // crash. |
| 410 TemplateURLModel* template_url_model_; | 419 TemplateURLModel* template_url_model_; |
| 411 | 420 |
| 412 // Tracks this preference to determine whether bookmark editing is allowed. | 421 // Tracks this preference to determine whether bookmark editing is allowed. |
| 413 BooleanPrefMember edit_bookmarks_enabled_; | 422 BooleanPrefMember edit_bookmarks_enabled_; |
| 414 | 423 |
| 424 // While animating, the host clips the widget and draws only the bottom | |
| 425 // part of it. The view needs to know the pixel offset at which we are drawing | |
| 426 // the widget so that we can draw the curved edges that attach to the toolbar | |
| 427 // in the right location. | |
| 428 int animation_offset_; | |
|
sky
2011/05/03 18:38:32
Initialize this to 0.
SteveT
2011/05/06 18:48:43
Done.
| |
| 429 | |
| 415 DISALLOW_IMPLICIT_CONSTRUCTORS(LocationBarView); | 430 DISALLOW_IMPLICIT_CONSTRUCTORS(LocationBarView); |
| 416 }; | 431 }; |
| 417 | 432 |
| 418 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_ | 433 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_ |
| OLD | NEW |