15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved.
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file.
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <string>
95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <vector>
105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/compiler_specific.h"
122a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "base/prefs/pref_member.h"
135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "chrome/browser/extensions/extension_context_menu_model.h"
14116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch#include "chrome/browser/ui/location_bar/location_bar.h"
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "chrome/browser/ui/omnibox/omnibox_edit_controller.h"
167dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch#include "chrome/browser/ui/search/search_model_observer.h"
175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "chrome/browser/ui/toolbar/toolbar_model.h"
185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "chrome/browser/ui/views/dropdown_bar_host.h"
195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "chrome/browser/ui/views/dropdown_bar_host_delegate.h"
205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "chrome/browser/ui/views/extensions/extension_popup.h"
21f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)#include "chrome/browser/ui/views/omnibox/omnibox_view_views.h"
22116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch#include "components/search_engines/template_url_service_observer.h"
23effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch#include "ui/gfx/animation/animation_delegate.h"
245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ui/gfx/font.h"
255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ui/gfx/rect.h"
267dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch#include "ui/views/controls/button/button.h"
275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ui/views/drag_controller.h"
285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class ActionBoxButtonView;
305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class CommandUpdater;
315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class ContentSettingBubbleModelDelegate;
325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class ContentSettingImageView;
335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class EVBubbleView;
345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class ExtensionAction;
355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class GURL;
36ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdochclass GeneratedCreditCardView;
375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class InstantController;
385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class KeywordHintView;
395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class LocationIconView;
405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class OpenPDFInReaderView;
41f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)class ManagePasswordsIconView;
425d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)class OriginChipView;
435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class PageActionWithBadgeView;
445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class PageActionImageView;
455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class Profile;
46f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)class SearchButton;
475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class SelectedKeywordView;
485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class StarView;
495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class TemplateURLService;
501e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)class TranslateIconView;
515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class ZoomView;
525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
53f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)namespace content {
54f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)struct SSLStatus;
55f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)}
56f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
57effb81e5f8246d0db0270817048dc992db66e9fbBen Murdochnamespace gfx {
58effb81e5f8246d0db0270817048dc992db66e9fbBen Murdochclass SlideAnimation;
59effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch}
60effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch
615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace views {
625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class BubbleDelegateView;
63ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdochclass ImageButton;
645d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)class ImageView;
655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class Label;
665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class Widget;
675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/////////////////////////////////////////////////////////////////////////////
705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//
715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// LocationBarView class
725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//
735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//   The LocationBarView class is a View subclass that paints the background
745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//   of the URL bar strip and contains its content.
755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//
765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/////////////////////////////////////////////////////////////////////////////
775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class LocationBarView : public LocationBar,
785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                        public LocationBarTesting,
795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                        public views::View,
807dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch                        public views::ButtonListener,
815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                        public views::DragController,
825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                        public OmniboxEditController,
835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                        public DropdownBarHostDelegate,
84effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch                        public gfx::AnimationDelegate,
855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                        public TemplateURLServiceObserver,
867dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch                        public SearchModelObserver {
875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) public:
885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The location bar view's class name.
895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  static const char kViewClassName[];
905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
91effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  // Returns the offset used during dropdown animation.
92effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  int dropdown_animation_offset() const { return dropdown_animation_offset_; }
935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  class Delegate {
955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   public:
962a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    // Should return the current web contents.
973551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)    virtual content::WebContents* GetWebContents() = 0;
985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    // Returns the InstantController, or NULL if there isn't one.
1005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    virtual InstantController* GetInstant() = 0;
1015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1023551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)    virtual ToolbarModel* GetToolbarModel() = 0;
1033551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)    virtual const ToolbarModel* GetToolbarModel() const = 0;
1043551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
1055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    // Creates Widget for the given delegate.
1065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    virtual views::Widget* CreateViewsBubble(
1075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)        views::BubbleDelegateView* bubble_delegate) = 0;
1085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    // Creates PageActionImageView. Caller gets an ownership.
1105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    virtual PageActionImageView* CreatePageActionImageView(
1115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)        LocationBarView* owner,
1125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)        ExtensionAction* action) = 0;
1135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    // Returns ContentSettingBubbleModelDelegate.
1155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    virtual ContentSettingBubbleModelDelegate*
1165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)        GetContentSettingBubbleModelDelegate() = 0;
1175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1182a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    // Shows permissions and settings for the given web contents.
1192a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    virtual void ShowWebsiteSettings(content::WebContents* web_contents,
1202a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                                     const GURL& url,
1217dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch                                     const content::SSLStatus& ssl) = 0;
1225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   protected:
1245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    virtual ~Delegate() {}
1255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  };
1265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  enum ColorKind {
1285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    BACKGROUND = 0,
1295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    TEXT,
1305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    SELECTED_TEXT,
1315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    DEEMPHASIZED_TEXT,
1325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    SECURITY_TEXT,
1335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  };
1345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  LocationBarView(Browser* browser,
1365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                  Profile* profile,
1375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                  CommandUpdater* command_updater,
1385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                  Delegate* delegate,
13990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)                  bool is_popup_mode);
1405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual ~LocationBarView();
1425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Initializes the LocationBarView.
1445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void Init();
1455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // True if this instance has been initialized by calling Init, which can only
1475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // be called when the receiving instance is attached to a view container.
1485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool IsInitialized() const;
1495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns the appropriate color for the desired kind, based on the user's
1515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // system theme.
1525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  SkColor GetColor(ToolbarModel::SecurityLevel security_level,
1535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                   ColorKind kind) const;
1545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns the delegate.
1565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  Delegate* delegate() const { return delegate_; }
1575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // See comment in browser_window.h for more info.
1595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void ZoomChangedForActiveTab(bool can_show_bubble);
1605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
161f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // The zoom icon. It may not be visible.
1622a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  ZoomView* zoom_view() { return zoom_view_; }
1632a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
164f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // The passwords icon. It may not be visible.
165f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  ManagePasswordsIconView* manage_passwords_icon_view() {
166f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)    return manage_passwords_icon_view_;
167f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  }
168f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
1695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Sets |preview_enabled| for the PageAction View associated with this
1705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // |page_action|. If |preview_enabled| is true, the view will display the
1715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // PageActions icon even though it has not been activated by the extension.
1725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // This is used by the ExtensionInstalledBubble to preview what the icon
1735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // will look like for the user upon installation of the extension.
1745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void SetPreviewEnabledPageAction(ExtensionAction* page_action,
1755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                                   bool preview_enabled);
1765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Retrieves the PageAction View which is associated with |page_action|.
178a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PageActionWithBadgeView* GetPageActionView(ExtensionAction* page_action);
1795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Toggles the star on or off.
1815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void SetStarToggled(bool on);
1825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
183f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // The star. It may not be visible.
1845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  StarView* star_view() { return star_view_; }
1855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
186f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // Toggles the translate icon on or off.
187f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  void SetTranslateIconToggled(bool on);
188f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
189f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // The translate icon. It may not be visible.
190f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  TranslateIconView* translate_icon_view() { return translate_icon_view_; }
1911e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
192f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // Returns the screen coordinates of the omnibox (where the URL text appears,
193f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // not where the icons are shown).
194f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  gfx::Point GetOmniboxViewOrigin() const;
1955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
196868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // Shows |text| as an inline autocompletion.  This is useful for IMEs, where
197868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // we can't show the autocompletion inside the actual OmniboxView.  See
198868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // comments on |ime_inline_autocomplete_view_|.
199a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  void SetImeInlineAutocompletion(const base::string16& text);
200868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
2017dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  // Invoked from OmniboxViewWin to show gray text autocompletion.
202a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  void SetGrayTextAutocompletion(const base::string16& text);
2035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2047dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  // Returns the current gray text autocompletion.
205a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  base::string16 GetGrayTextAutocompletion() const;
2065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Set if we should show a focus rect while the location entry field is
2085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // focused. Used when the toolbar is in full keyboard accessibility mode.
2095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Repaints if necessary.
2105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void SetShowFocusRect(bool show);
2115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Select all of the text. Needed when the user tabs through controls
2135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // in the toolbar in full keyboard accessibility mode.
2145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void SelectAll();
2155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
216cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  LocationIconView* location_icon_view() { return location_icon_view_; }
2175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
218f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // Return the point suitable for anchoring location-bar-anchored bubbles at.
219f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // The point will be returned in the coordinates of the LocationBarView.
220f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  gfx::Point GetLocationBarAnchorPoint() const;
221f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
2225d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  OmniboxViewViews* omnibox_view() { return omnibox_view_; }
223cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  const OmniboxViewViews* omnibox_view() const { return omnibox_view_; }
2245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
225ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch  views::View* generated_credit_card_view();
2267dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
2275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns the height of the control without the top and bottom
2285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // edges(i.e.  the height of the edit control inside).  If
2295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // |use_preferred_size| is true this will be the preferred height,
2305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // otherwise it will be the current height.
2315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  int GetInternalHeight(bool use_preferred_size);
2325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
233868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // Returns the position and width that the popup should be, and also the left
234868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // edge that the results should align themselves to (which will leave some
235868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // border on the left of the popup).
236ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch  void GetOmniboxPopupPositioningInfo(gfx::Point* top_left_screen_coord,
237ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch                                      int* popup_width,
238ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch                                      int* left_margin,
239ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch                                      int* right_margin);
240868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
241c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  // LocationBar:
242c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  virtual void FocusLocation(bool select_all) OVERRIDE;
243c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  virtual void Revert() OVERRIDE;
244c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  virtual OmniboxView* GetOmniboxView() OVERRIDE;
245c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch
246c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  // views::View:
247c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  virtual bool HasFocus() const OVERRIDE;
248c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE;
249cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  virtual gfx::Size GetPreferredSize() const OVERRIDE;
250c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  virtual void Layout() OVERRIDE;
251c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch
252c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  // OmniboxEditController:
253c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  virtual void Update(const content::WebContents* contents) OVERRIDE;
254c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  virtual void ShowURL() OVERRIDE;
25546d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  virtual void EndOriginChipAnimations(bool cancel_fade) OVERRIDE;
256c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  virtual ToolbarModel* GetToolbarModel() OVERRIDE;
257c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  virtual content::WebContents* GetWebContents() OVERRIDE;
258c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch
259868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // Thickness of the edges of the omnibox background images, in normal mode.
260868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  static const int kNormalEdgeThickness;
26190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // The same, but for popup mode.
26290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  static const int kPopupEdgeThickness;
2635c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu  // Space between items in the location bar, as well as between items and the
2645c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu  // edges.
2655c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu  static const int kItemPadding;
2665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Amount of padding built into the standard omnibox icons.
2675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  static const int kIconInternalPadding;
268a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  // Amount of padding to place between the origin chip and the leading edge of
269a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  // the location bar.
270a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  static const int kOriginChipEdgeItemPadding;
271a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  // Amount of padding built into the origin chip.
272a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  static const int kOriginChipBuiltinPadding;
2735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Space between the edge and a bubble.
27490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  static const int kBubblePadding;
2755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
276effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch private:
2775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  typedef std::vector<ContentSettingImageView*> ContentSettingViews;
2785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  friend class PageActionImageView;
2805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  friend class PageActionWithBadgeView;
2815d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  typedef std::vector<ExtensionAction*> PageActions;
2825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  typedef std::vector<PageActionWithBadgeView*> PageActionViews;
2835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
284cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // Helper for GetMinimumWidth().  Calculates the incremental minimum width
285cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // |view| should add to the trailing width after the omnibox.
286cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  static int IncrementalMinimumWidth(views::View* view);
287cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
28890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // Returns the thickness of any visible left and right edge, in pixels.
28990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  int GetHorizontalEdgeThickness() const;
29090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
29190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // The same, but for the top and bottom edges.
29290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  int vertical_edge_thickness() const {
293868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    return is_popup_mode_ ? kPopupEdgeThickness : kNormalEdgeThickness;
29490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  }
29590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
29658537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  // Updates the visibility state of the Content Blocked icons to reflect what
297f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // is actually blocked on the current page. Returns true if the visibility
298f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // of at least one of the views in |content_setting_views_| changed.
299f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  bool RefreshContentSettingViews();
3005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3011e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  // Deletes all page action views that we have created.
3025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void DeletePageActionViews();
3035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3041e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  // Updates the views for the Page Actions, to reflect state changes for
305f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // PageActions. Returns true if the visibility of a PageActionWithBadgeView
306f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // changed, or PageActionWithBadgeView were created/destroyed.
307f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  bool RefreshPageActionViews();
3085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
309f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // Updates the view for the zoom icon based on the current tab's zoom. Returns
310f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // true if the visibility of the view changed.
311f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  bool RefreshZoomView();
3125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3131e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  // Updates the Translate icon based on the current tab's Translate status.
3141e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  void RefreshTranslateIcon();
3151e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
316f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // Updates |manage_passwords_icon_view_|. Returns true if visibility changed.
317f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  bool RefreshManagePasswordsIconView();
318f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
3195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Helper to show the first run info bubble.
3205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void ShowFirstRunBubbleInternal();
3215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
322c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  // Returns true if the suggest text is valid.
323c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  bool HasValidSuggestText() const;
324c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch
325cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  bool ShouldShowKeywordBubble() const;
326cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  bool ShouldShowEVBubble() const;
327cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
32846d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  // Used to "reverse" the URL showing/hiding animations, since we use separate
32946d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  // animations whose curves are not true inverses of each other.  Based on the
33046d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  // current position of the omnibox, calculates what value the desired
33146d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  // animation (|hide_url_animation_| if |hide| is true, |show_url_animation_|
33246d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  // if it's false) should be set to in order to produce the same omnibox
33346d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  // position.  This way we can stop the old animation, set the new animation to
33446d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  // this value, and start it running, and the text will appear to reverse
33546d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  // directions from its current location.
33646d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  double GetValueForAnimation(bool hide) const;
33746d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
33846d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  // Resets |show_url_animation_| and the color changes it causes.
33946d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  void ResetShowAnimationAndColors();
340effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch
341c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  // LocationBar:
342c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  virtual void ShowFirstRunBubble() OVERRIDE;
343c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  virtual GURL GetDestinationURL() const OVERRIDE;
344c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  virtual WindowOpenDisposition GetWindowOpenDisposition() const OVERRIDE;
3451320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  virtual ui::PageTransition GetPageTransition() const OVERRIDE;
346c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  virtual void AcceptInput() OVERRIDE;
347c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  virtual void FocusSearch() OVERRIDE;
348c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  virtual void UpdateContentSettingsIcons() OVERRIDE;
349c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  virtual void UpdateManagePasswordsIconAndBubble() OVERRIDE;
350c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  virtual void UpdatePageActions() OVERRIDE;
351c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  virtual void InvalidatePageActions() OVERRIDE;
3521320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  virtual void UpdateBookmarkStarVisibility() OVERRIDE;
3531320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  virtual bool ShowPageActionPopup(const extensions::Extension* extension,
3541320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci                                   bool grant_active_tab) OVERRIDE;
355c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  virtual void UpdateOpenPDFInReaderPrompt() OVERRIDE;
356c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  virtual void UpdateGeneratedCreditCardView() OVERRIDE;
357c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  virtual void SaveStateToContents(content::WebContents* contents) OVERRIDE;
358c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  virtual const OmniboxView* GetOmniboxView() const OVERRIDE;
359c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  virtual LocationBarTesting* GetLocationBarForTesting() OVERRIDE;
360c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch
361c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  // LocationBarTesting:
362c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  virtual int PageActionCount() OVERRIDE;
363c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  virtual int PageActionVisibleCount() OVERRIDE;
364c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  virtual ExtensionAction* GetPageAction(size_t index) OVERRIDE;
365c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  virtual ExtensionAction* GetVisiblePageAction(size_t index) OVERRIDE;
366c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  virtual void TestPageActionPressed(size_t index) OVERRIDE;
367c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  virtual bool GetBookmarkStarVisibility() OVERRIDE;
368c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch
369c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  // views::View:
370c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  virtual const char* GetClassName() const OVERRIDE;
371c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE;
37246d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  virtual void OnFocus() OVERRIDE;
373c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
374cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  virtual void PaintChildren(gfx::Canvas* canvas,
375cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)                             const views::CullSet& cull_set) OVERRIDE;
376c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch
377c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  // views::ButtonListener:
378c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  virtual void ButtonPressed(views::Button* sender,
379c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch                             const ui::Event& event) OVERRIDE;
380c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch
381c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  // views::DragController:
382c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  virtual void WriteDragDataForView(View* sender,
383c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch                                    const gfx::Point& press_pt,
384c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch                                    OSExchangeData* data) OVERRIDE;
385c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  virtual int GetDragOperationsForView(View* sender,
386c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch                                       const gfx::Point& p) OVERRIDE;
387c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  virtual bool CanStartDragForView(View* sender,
388c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch                                   const gfx::Point& press_pt,
389c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch                                   const gfx::Point& p) OVERRIDE;
390c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch
391c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  // OmniboxEditController:
392c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  virtual void OnChanged() OVERRIDE;
393c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  virtual void OnSetFocus() OVERRIDE;
394c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  virtual InstantController* GetInstant() OVERRIDE;
395c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  virtual const ToolbarModel* GetToolbarModel() const OVERRIDE;
396c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  virtual void HideURL() OVERRIDE;
397c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch
398c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  // DropdownBarHostDelegate:
399c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  virtual void SetFocusAndSelection(bool select_all) OVERRIDE;
400c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  virtual void SetAnimationOffset(int offset) OVERRIDE;
401c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch
402c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  // gfx::AnimationDelegate:
403c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE;
404c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE;
405c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch
406c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  // TemplateURLServiceObserver:
407c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  virtual void OnTemplateURLServiceChanged() OVERRIDE;
408c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch
409c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  // SearchModelObserver:
410c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  virtual void ModelChanged(const SearchModel::State& old_state,
411c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch                            const SearchModel::State& new_state) OVERRIDE;
412c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch
4135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The Browser this LocationBarView is in.  Note that at least
4145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // chromeos::SimpleWebViewDialog uses a LocationBarView outside any browser
4155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // window, so this may be NULL.
4165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  Browser* browser_;
4175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
418f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  OmniboxViewViews* omnibox_view_;
4195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Our delegate.
4215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  Delegate* delegate_;
4225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4235d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Object used to paint the border.
4245d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  scoped_ptr<views::Painter> border_painter_;
4255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
426cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // The origin chip that may appear in the location bar.
427a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  OriginChipView* origin_chip_view_;
428a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
4295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // An icon to the left of the edit field.
4305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  LocationIconView* location_icon_view_;
4315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // A bubble displayed for EV HTTPS sites.
4335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  EVBubbleView* ev_bubble_view_;
4345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
435868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // A view to show inline autocompletion when an IME is active.  In this case,
436868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // we shouldn't change the text or selection inside the OmniboxView itself,
437868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // since this will conflict with the IME's control over the text.  So instead
438868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // we show any autocompletion in a separate field after the OmniboxView.
439868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  views::Label* ime_inline_autocomplete_view_;
440868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
4415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The following views are used to provide hints and remind the user as to
4425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // what is going in the edit. They are all added a children of the
4435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // LocationBarView. At most one is visible at a time. Preference is
4445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // given to the keyword_view_, then hint_view_.
4455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // These autocollapse when the edit needs the room.
4465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Shown if the user has selected a keyword.
4485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  SelectedKeywordView* selected_keyword_view_;
4495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // View responsible for showing suggested text. This is NULL when there is no
4515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // suggested text.
4525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  views::Label* suggested_text_view_;
4535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Shown if the selected url has a corresponding keyword.
4555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  KeywordHintView* keyword_hint_view_;
4565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4577dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  // The voice search icon.
458ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch  views::ImageButton* mic_search_view_;
4597dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
4605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The content setting views.
4615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  ContentSettingViews content_setting_views_;
4625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The zoom icon.
4645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  ZoomView* zoom_view_;
4655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
466ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch  // A bubble that shows after successfully generating a new credit card number.
467ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch  GeneratedCreditCardView* generated_credit_card_view_;
4687dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
4695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The icon to open a PDF in Reader.
4705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  OpenPDFInReaderView* open_pdf_in_reader_view_;
4715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
472f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // The manage passwords icon.
473f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  ManagePasswordsIconView* manage_passwords_icon_view_;
474f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
4755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The current page actions.
4765d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  PageActions page_actions_;
4775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The page action icon views.
4795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  PageActionViews page_action_views_;
4805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4811e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  // The icon for Translate.
4821e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  TranslateIconView* translate_icon_view_;
4831e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
484f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // The star.
485f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  StarView* star_view_;
486f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
487a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // The search/go button.
488f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)  SearchButton* search_button_;
489a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
4904e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  // Whether we're in popup mode. This value also controls whether the location
4914e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  // bar is read-only.
49290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  const bool is_popup_mode_;
4935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // True if we should show a focus rect while the location entry field is
4955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // focused. Used when the toolbar is in full keyboard accessibility mode.
4965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool show_focus_rect_;
4975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // This is in case we're destroyed before the model loads. We need to make
4995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Add/RemoveObserver calls.
5005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  TemplateURLService* template_url_service_;
5015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
5025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Tracks this preference to determine whether bookmark editing is allowed.
5035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  BooleanPrefMember edit_bookmarks_enabled_;
5045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
505effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  // During dropdown animation, the host clips the widget and draws only the
506effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  // bottom part of it. The view needs to know the pixel offset at which we are
507effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  // drawing the widget so that we can draw the curved edges that attach to the
508effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  // toolbar in the right location.
509effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  int dropdown_animation_offset_;
510effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch
511effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  // Origin chip animations.
51246d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  //
51346d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  // For the "show URL" animation, we instantly hide the origin chip and show
51446d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  // the |omnibox_view_| in its place, containing the complete URL.  However, we
51546d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  // clip that view (using the XXX_leading_inset_ and XXX_width_ members) so
51646d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  // that only the hostname is visible.  We also offset the omnibox (using the
51746d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  // XXX_offset_ members) so the hostname is in the same place as it was in the
51846d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  // origin chip.  Finally, we set the selection text and background color of
51946d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  // the text to match the pressed origin chip.  Then, as the animation runs,
52046d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  // all of these values are animated to their steady-state values (no omnibox
52146d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  // offset, no inset, width equal to the full omnibox text [which is reset to
52246d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  // "no width clamp" after the animation ends], and standard selection colors).
52346d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  //
52446d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  // For the hide animation, we run the positioning and clipping parts of the
52546d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  // animation in reverse, but instead of changing the selection color, because
52646d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  // there usually isn't a selection when hiding, we leave the omnibox colors
52746d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  // alone, and when the hide animation has ended, tell the origin chip to
52846d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  // fade-in its background.
529effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  scoped_ptr<gfx::SlideAnimation> show_url_animation_;
530effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  scoped_ptr<gfx::SlideAnimation> hide_url_animation_;
53146d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  // The omnibox offset may be positive or negative.  The starting offset is the
53246d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  // amount necessary to shift the |omnibox_view_| by such that the hostname
53346d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  // portion of the URL aligns with the hostname in the origin chip.  As the
53446d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  // show animation runs, the current offset gradually moves to 0.
53546d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  int starting_omnibox_offset_;
53646d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  int current_omnibox_offset_;
53746d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  // The leading inset is always positive.  The starting inset is the width of
53846d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  // the text between the leading edge of the omnibox and the edge of the
53946d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  // hostname, which is clipped off at the start of the show animation.  Note
54046d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  // that in RTL mode, this will be the part of the URL that is logically after
54146d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  // the hostname.  As the show animation runs, the current inset gradually
54246d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  // moves to 0.
54346d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  int starting_omnibox_leading_inset_;
54446d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  int current_omnibox_leading_inset_;
54546d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  // The width is always positive.  The ending width is the width of the entire
54646d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  // omnibox URL.  As the show animation runs, the current width gradually moves
54746d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  // from the width of the hostname to the ending value.
54846d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  int current_omnibox_width_;
54946d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  int ending_omnibox_width_;
5505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
55190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  DISALLOW_COPY_AND_ASSIGN(LocationBarView);
5525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)};
5535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
5545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif  // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_
555