Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3094)

Unified Diff: chrome/browser/ui/views/location_bar/location_bar_view.h

Issue 200783003: [OriginChip] Add animations for the hiding and showing of the chip. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/location_bar/location_bar_view.h
diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.h b/chrome/browser/ui/views/location_bar/location_bar_view.h
index 51489ba28a0f17ec02fdf1e0d586af6b220a1a65..1406bfb57313e2fedfaceb46c348c4bad928f80d 100644
--- a/chrome/browser/ui/views/location_bar/location_bar_view.h
+++ b/chrome/browser/ui/views/location_bar/location_bar_view.h
@@ -23,6 +23,7 @@
#include "chrome/browser/ui/views/omnibox/omnibox_view_views.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
+#include "ui/gfx/animation/animation_delegate.h"
#include "ui/gfx/font.h"
#include "ui/gfx/rect.h"
#include "ui/views/controls/button/button.h"
@@ -56,6 +57,10 @@ namespace content {
struct SSLStatus;
}
+namespace gfx {
+class SlideAnimation;
+}
+
namespace views {
class BubbleDelegateView;
class ImageButton;
@@ -80,6 +85,7 @@ class LocationBarView : public LocationBar,
public views::DragController,
public OmniboxEditController,
public DropdownBarHostDelegate,
+ public gfx::AnimationDelegate,
public TemplateURLServiceObserver,
public content::NotificationObserver,
public SearchModelObserver {
@@ -91,7 +97,7 @@ class LocationBarView : public LocationBar,
virtual void SetFocusAndSelection(bool select_all) OVERRIDE;
virtual void SetAnimationOffset(int offset) OVERRIDE;
- // Returns the offset used while animating.
+ // Returns the offset used during dropdown animation.
int animation_offset() const { return animation_offset_; }
Peter Kasting 2014/03/21 21:22:10 Nit: Perhaps this accessor and member should be na
Justin Donnelly 2014/03/24 22:59:37 Done.
class Delegate {
@@ -255,11 +261,16 @@ class LocationBarView : public LocationBar,
virtual void Update(const content::WebContents* contents) OVERRIDE;
virtual void OnChanged() OVERRIDE;
virtual void OnSetFocus() OVERRIDE;
+ virtual void ShowURL() OVERRIDE;
virtual InstantController* GetInstant() OVERRIDE;
virtual content::WebContents* GetWebContents() OVERRIDE;
virtual ToolbarModel* GetToolbarModel() OVERRIDE;
virtual const ToolbarModel* GetToolbarModel() const OVERRIDE;
+ // gfx::AnimationDelegate:
Peter Kasting 2014/03/21 21:22:10 Wow, these sections are all in a totally random or
Justin Donnelly 2014/03/24 22:59:37 Ok, I'll reorder in a follow-on change.
+ virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE;
+ virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE;
+
// views::View:
virtual const char* GetClassName() const OVERRIDE;
virtual bool HasFocus() const OVERRIDE;
@@ -353,8 +364,12 @@ class LocationBarView : public LocationBar,
static const int kBubblePadding;
protected:
+ // views::View:
virtual void OnFocus() OVERRIDE;
+ // OmniboxEditController:
+ virtual void HideURLAndShowOriginChip() OVERRIDE;
Peter Kasting 2014/03/21 21:22:10 In principle, we should be making inherited method
Justin Donnelly 2014/03/24 22:59:37 Done.
+
private:
typedef std::vector<ContentSettingImageView*> ContentSettingViews;
@@ -416,6 +431,10 @@ class LocationBarView : public LocationBar,
// don't normally use this). Sets the value and clears the selection.
void AccessibilitySetValue(const base::string16& new_value);
+ // Origin chip animation control methods.
+ void OnShowURLAnimationEnded();
+ void OnHideURLAnimationEnded();
+
// The Browser this LocationBarView is in. Note that at least
// chromeos::SimpleWebViewDialog uses a LocationBarView outside any browser
// window, so this may be NULL.
@@ -511,12 +530,19 @@ class LocationBarView : public LocationBar,
// Tracks this preference to determine whether bookmark editing is allowed.
BooleanPrefMember edit_bookmarks_enabled_;
- // While animating, the host clips the widget and draws only the bottom
- // part of it. The view needs to know the pixel offset at which we are drawing
- // the widget so that we can draw the curved edges that attach to the toolbar
- // in the right location.
+ // During dropdown animation, the host clips the widget and draws only the
+ // bottom part of it. The view needs to know the pixel offset at which we are
+ // drawing the widget so that we can draw the curved edges that attach to the
+ // toolbar in the right location.
int animation_offset_;
+ // Origin chip animations.
+ scoped_ptr<gfx::SlideAnimation> show_url_animation_;
+ scoped_ptr<gfx::SlideAnimation> hide_url_animation_;
+
+ // Text label shown only during origin chip animations.
+ views::Label* animated_host_label_;
+
// Used to register for notifications received by NotificationObserver.
content::NotificationRegistrar registrar_;

Powered by Google App Engine
This is Rietveld 408576698