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

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

Issue 302453002: New animation for the origin chip URL showing/hiding. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Bugfixes and more animations Created 6 years, 7 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/origin_chip_view.h
diff --git a/chrome/browser/ui/views/location_bar/origin_chip_view.h b/chrome/browser/ui/views/location_bar/origin_chip_view.h
index a6cfa14b8d88f5e91d7503bbdbd7b39bdd9f70f7..976160aef5038bb1f356bc124dbef37a7e67607a 100644
--- a/chrome/browser/ui/views/location_bar/origin_chip_view.h
+++ b/chrome/browser/ui/views/location_bar/origin_chip_view.h
@@ -8,6 +8,7 @@
#include "chrome/browser/safe_browsing/ui_manager.h"
#include "chrome/browser/ui/toolbar/toolbar_model.h"
#include "chrome/browser/ui/views/location_bar/location_icon_view.h"
+#include "ui/gfx/animation/slide_animation.h"
#include "ui/views/controls/button/button.h"
#include "ui/views/controls/button/label_button.h"
@@ -20,13 +21,10 @@ class WebContents;
}
namespace gfx {
-class Canvas;
class FontList;
-class SlideAnimation;
}
namespace views {
-class Button;
class Label;
}
@@ -39,43 +37,40 @@ class OriginChipView : public views::LabelButton,
const gfx::FontList& font_list);
virtual ~OriginChipView();
- // Recalculates the contents of the Origin Chip based on the displayed tab.
- void Update(content::WebContents* tab);
+ SkColor pressed_text_color() const { return pressed_text_color_; }
+ SkColor pressed_background_color() const {
+ return background_colors_[Button::STATE_PRESSED];
+ }
+ const base::string16& host_label_text() const { return host_label_->text(); }
// Called to signal that the contents of the tab being shown has changed, so
// the origin chip needs to update itself to the new state.
void OnChanged();
- views::ImageView* location_icon_view() {
- return location_icon_view_;
- }
- const views::ImageView* location_icon_view() const {
- return location_icon_view_;
- }
-
- // Elides the hostname shown to the indicated width, if needed. Returns the
- // final width of the origin chip. Note: this may be more than the target
- // width, since the hostname will not be elided past the TLD+1.
- int ElideDomainTarget(int target_max_width);
-
- // Starts an animation that fades in the border.
+ // Starts/stops a fade-in animation for the border.
void FadeIn();
+ void CancelFade();
- // Returns the current X position of the host label.
- int host_label_x() const { return host_label_->x(); }
+ // Returns the offset of the host label, relative to where the first label
Justin Donnelly 2014/05/29 21:37:29 The comments for this method and GetLabelX would m
Peter Kasting 2014/05/29 23:32:16 Done.
+ // starts.
+ int HostLabelOffset() const;
// views::LabelButton:
virtual gfx::Size GetPreferredSize() const OVERRIDE;
+ virtual void Layout() OVERRIDE;
private:
+ // Returns the X coordinate the first label should be placed at.
+ int GetLabelX() const;
+
// Sets an image grid to represent the current security state.
void SetBorderImages(const int images[3][9]);
// views::LabelButton:
virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE;
virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE;
- virtual void Layout() OVERRIDE;
virtual void OnPaintBorder(gfx::Canvas* canvas) OVERRIDE;
+ virtual void StateChanged() OVERRIDE;
// views::ButtonListener:
virtual void ButtonPressed(views::Button* sender,
@@ -89,14 +84,17 @@ class OriginChipView : public views::LabelButton,
LocationBarView* location_bar_view_;
Profile* profile_;
+ SkColor pressed_text_color_;
+ SkColor background_colors_[3];
+ views::Label* ev_label_;
views::Label* host_label_;
LocationIconView* location_icon_view_;
bool showing_16x16_icon_;
scoped_ptr<OriginChipExtensionIcon> extension_icon_;
+ gfx::SlideAnimation fade_in_animation_;
GURL url_displayed_;
ToolbarModel::SecurityLevel security_level_;
bool url_malware_;
- scoped_ptr<gfx::SlideAnimation> fade_in_animation_;
DISALLOW_COPY_AND_ASSIGN(OriginChipView);
};

Powered by Google App Engine
This is Rietveld 408576698