Index: chrome/browser/views/location_bar_view.h |
=================================================================== |
--- chrome/browser/views/location_bar_view.h (revision 42491) |
+++ chrome/browser/views/location_bar_view.h (working copy) |
@@ -75,9 +75,6 @@ |
SELECTED_TEXT, |
DEEMPHASIZED_TEXT, |
SECURITY_TEXT, |
- SECURITY_INFO_BUBBLE_TEXT, |
- SCHEME_STRIKEOUT, |
- NUM_KINDS |
}; |
LocationBarView(Profile* profile, |
@@ -96,7 +93,8 @@ |
// Returns the appropriate color for the desired kind, based on the user's |
// system theme. |
- static SkColor GetColor(bool is_secure, ColorKind kind); |
+ static SkColor GetColor(ToolbarModel::SecurityLevel security_level, |
+ ColorKind kind); |
// Updates the location bar. We also reset the bar's permanent text and |
// security style, and, if |tab_for_state_restoring| is non-NULL, also restore |
@@ -191,6 +189,26 @@ |
void Focus(); |
private: |
+ // SecurityImageView is used to display the appropriate status icon when the |
+ // current URL's scheme is https. |
+ class SecurityImageView : public views::ImageView { |
+ public: |
+ explicit SecurityImageView(const LocationBarView* parent); |
+ virtual ~SecurityImageView(); |
+ |
+ // Sets the image that should be displayed. |
+ void SetSecurityIcon(int resource_id); |
+ |
+ // Overridden from view. |
+ virtual bool OnMousePressed(const views::MouseEvent& event); |
+ |
+ private: |
+ // The owning LocationBarView. |
+ const LocationBarView* parent_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(SecurityImageView); |
+ }; |
+ |
// View used when the user has selected a keyword. |
// |
// SelectedKeywordView maintains two labels. One label contains the |
@@ -279,95 +297,6 @@ |
DISALLOW_COPY_AND_ASSIGN(KeywordHintView); |
}; |
- class ShowInfoBubbleTask; |
- class ShowFirstRunBubbleTask; |
- |
- class LocationBarImageView : public views::ImageView, |
- public InfoBubbleDelegate { |
- public: |
- explicit LocationBarImageView(const BubblePositioner* bubble_positioner); |
- virtual ~LocationBarImageView(); |
- |
- // Overridden from view for the mouse hovering. |
- virtual void OnMouseMoved(const views::MouseEvent& event); |
- virtual void OnMouseExited(const views::MouseEvent& event); |
- virtual bool OnMousePressed(const views::MouseEvent& event) = 0; |
- |
- // InfoBubbleDelegate |
- void InfoBubbleClosing(InfoBubble* info_bubble, bool closed_by_escape); |
- bool CloseOnEscape() { return true; } |
- |
- virtual void ShowInfoBubble() = 0; |
- |
- protected: |
- void ShowInfoBubbleImpl(const std::wstring& text, SkColor text_color); |
- |
- private: |
- friend class ShowInfoBubbleTask; |
- |
- // The currently shown info bubble if any. |
- InfoBubble* info_bubble_; |
- |
- // A task used to display the info bubble when the mouse hovers on the |
- // image. |
- ShowInfoBubbleTask* show_info_bubble_task_; |
- |
- // A positioner used to give the info bubble the correct target bounds. The |
- // caller maintains ownership of this and must ensure it's kept alive. |
- const BubblePositioner* bubble_positioner_; |
- |
- DISALLOW_COPY_AND_ASSIGN(LocationBarImageView); |
- }; |
- |
- // SecurityImageView is used to display the lock or warning icon when the |
- // current URL's scheme is https. |
- // |
- // If a message has been set with SetInfoBubbleText, it displays an info |
- // bubble when the mouse hovers on the image. |
- class SecurityImageView : public LocationBarImageView { |
- public: |
- enum Image { |
- LOCK = 0, |
- WARNING |
- }; |
- |
- SecurityImageView(const LocationBarView* parent, |
- Profile* profile, |
- ToolbarModel* model_, |
- const BubblePositioner* bubble_positioner); |
- virtual ~SecurityImageView(); |
- |
- // Sets the image that should be displayed. |
- void SetImageShown(Image image); |
- |
- // Overridden from view for the mouse hovering. |
- virtual bool OnMousePressed(const views::MouseEvent& event); |
- |
- void set_profile(Profile* profile) { profile_ = profile; } |
- |
- virtual void ShowInfoBubble(); |
- |
- private: |
- // The lock icon shown when using HTTPS. |
- static SkBitmap* lock_icon_; |
- |
- // The warning icon shown when HTTPS is broken. |
- static SkBitmap* warning_icon_; |
- |
- // A task used to display the info bubble when the mouse hovers on the |
- // image. |
- ShowInfoBubbleTask* show_info_bubble_task_; |
- |
- // The owning LocationBarView. |
- const LocationBarView* parent_; |
- |
- Profile* profile_; |
- |
- ToolbarModel* model_; |
- |
- DISALLOW_COPY_AND_ASSIGN(SecurityImageView); |
- }; |
- |
class ContentSettingImageView : public views::ImageView, |
public InfoBubbleDelegate { |
public: |
@@ -411,15 +340,14 @@ |
// PageActionImageView is used to display the icon for a given PageAction |
// and notify the extension when the icon is clicked. |
- class PageActionImageView : public LocationBarImageView, |
+ class PageActionImageView : public views::ImageView, |
public ImageLoadingTracker::Observer, |
public ExtensionContextMenuModel::PopupDelegate, |
public ExtensionPopup::Observer { |
public: |
PageActionImageView(LocationBarView* owner, |
Profile* profile, |
- ExtensionAction* page_action, |
- const BubblePositioner* bubble_positioner); |
+ ExtensionAction* page_action); |
virtual ~PageActionImageView(); |
ExtensionAction* page_action() { return page_action_; } |
@@ -431,13 +359,9 @@ |
} |
// Overridden from view. |
- virtual void OnMouseMoved(const views::MouseEvent& event); |
virtual bool OnMousePressed(const views::MouseEvent& event); |
virtual void OnMouseReleased(const views::MouseEvent& event, bool canceled); |
- // Overridden from LocationBarImageView. |
- virtual void ShowInfoBubble(); |
- |
// Overridden from ImageLoadingTracker. |
virtual void OnImageLoaded( |
SkBitmap* image, ExtensionResource resource, int index); |
@@ -531,10 +455,10 @@ |
// size. |
bool NeedsResize(View* view, int available_width); |
- // Adjusts the keyword hint, selected keyword and type to search views |
- // based on the contents of the edit. Returns true if something changed that |
- // necessitates a layout. |
- bool AdjustHints(int available_width); |
+ // Adjusts the keyword hint, selected keyword view, type to search label, and |
+ // security info label based on the contents of the edit. Returns true if |
+ // something changed that necessitates a layout. |
+ bool AdjustAutocollapseViews(int available_width); |
// If View fits in the specified region, it is made visible and the |
// bounds are adjusted appropriately. If the View does not fit, it is |
@@ -542,9 +466,6 @@ |
void LayoutView(bool leading, views::View* view, int available_width, |
gfx::Rect* bounds); |
- // Sets the security icon to display. Note that no repaint is done. |
- void SetSecurityIcon(ToolbarModel::Icon icon); |
- |
// Update the visibility state of the Content Blocked icons to reflect what is |
// actually blocked on the current page. |
void RefreshContentSettingViews(); |
@@ -556,13 +477,6 @@ |
// PageActions. |
void RefreshPageActionViews(); |
- // Sets the text that should be displayed in the info label and its associated |
- // tooltip text. Call with an empty string if the info label should be |
- // hidden. |
- void SetInfoText(const std::wstring& text, |
- ToolbarModel::InfoTextType text_type, |
- const std::wstring& tooltip_text); |
- |
// Sets the visibility of view to new_vis. Returns whether the visibility |
// changed. |
bool ToggleVisibility(bool new_vis, views::View* view); |
@@ -610,6 +524,9 @@ |
// Font used by edit and some of the hints. |
gfx::Font font_; |
+ // The view that shows the lock/warning when in HTTPS mode. |
+ SecurityImageView security_image_view_; |
+ |
// Location_entry view wrapper |
views::NativeViewHost* location_entry_view_; |
@@ -617,6 +534,8 @@ |
// what is going in the edit. They are all added a children of the |
// LocationBarView. At most one is visible at a time. Preference is |
// given to the keyword_view_, then hint_view_, then type_to_search_view_. |
+ // These, as well as |security_info_label_|, autocollapse when the edit needs |
+ // the room. |
// Shown if the user has selected a keyword. |
SelectedKeywordView selected_keyword_view_; |
@@ -627,8 +546,9 @@ |
// Shown if the text is not a keyword or url. |
views::Label type_to_search_view_; |
- // The view that shows the lock/warning when in HTTPS mode. |
- SecurityImageView security_image_view_; |
+ // A label displayed on the right side of the box to show more information |
+ // about certain security states. |
+ views::Label security_info_label_; |
// The content setting views. |
ContentSettingViews content_setting_views_; |
@@ -636,9 +556,6 @@ |
// The page action icon views. |
PageActionViews page_action_views_; |
- // A label displayed after the lock icon to show some extra information. |
- views::Label info_label_; |
- |
// When true, the location bar view is read only and also is has a slightly |
// different presentation (font size / color). This is used for popups. |
bool popup_window_mode_; |