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

Side by Side Diff: chrome/browser/ui/views/location_bar/location_bar_view.h

Issue 731423002: Remove OriginChip code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 21 matching lines...) Expand all
32 class ContentSettingImageView; 32 class ContentSettingImageView;
33 class EVBubbleView; 33 class EVBubbleView;
34 class ExtensionAction; 34 class ExtensionAction;
35 class GURL; 35 class GURL;
36 class GeneratedCreditCardView; 36 class GeneratedCreditCardView;
37 class InstantController; 37 class InstantController;
38 class KeywordHintView; 38 class KeywordHintView;
39 class LocationIconView; 39 class LocationIconView;
40 class OpenPDFInReaderView; 40 class OpenPDFInReaderView;
41 class ManagePasswordsIconView; 41 class ManagePasswordsIconView;
42 class OriginChipView;
43 class PageActionWithBadgeView; 42 class PageActionWithBadgeView;
44 class PageActionImageView; 43 class PageActionImageView;
45 class Profile; 44 class Profile;
46 class SearchButton; 45 class SearchButton;
47 class SelectedKeywordView; 46 class SelectedKeywordView;
48 class StarView; 47 class StarView;
49 class TemplateURLService; 48 class TemplateURLService;
50 class TranslateIconView; 49 class TranslateIconView;
51 class ZoomView; 50 class ZoomView;
52 51
53 namespace content { 52 namespace content {
54 struct SSLStatus; 53 struct SSLStatus;
55 } 54 }
56 55
57 namespace gfx {
58 class SlideAnimation;
59 }
60
61 namespace views { 56 namespace views {
62 class BubbleDelegateView; 57 class BubbleDelegateView;
63 class ImageButton; 58 class ImageButton;
64 class ImageView; 59 class ImageView;
65 class Label; 60 class Label;
66 class Widget; 61 class Widget;
67 } 62 }
68 63
69 ///////////////////////////////////////////////////////////////////////////// 64 /////////////////////////////////////////////////////////////////////////////
70 // 65 //
71 // LocationBarView class 66 // LocationBarView class
72 // 67 //
73 // The LocationBarView class is a View subclass that paints the background 68 // The LocationBarView class is a View subclass that paints the background
74 // of the URL bar strip and contains its content. 69 // of the URL bar strip and contains its content.
75 // 70 //
76 ///////////////////////////////////////////////////////////////////////////// 71 /////////////////////////////////////////////////////////////////////////////
77 class LocationBarView : public LocationBar, 72 class LocationBarView : public LocationBar,
78 public LocationBarTesting, 73 public LocationBarTesting,
79 public views::View, 74 public views::View,
80 public views::ButtonListener, 75 public views::ButtonListener,
81 public views::DragController, 76 public views::DragController,
82 public OmniboxEditController, 77 public OmniboxEditController,
83 public DropdownBarHostDelegate, 78 public DropdownBarHostDelegate,
84 public gfx::AnimationDelegate,
85 public TemplateURLServiceObserver, 79 public TemplateURLServiceObserver,
86 public SearchModelObserver { 80 public SearchModelObserver {
87 public: 81 public:
88 // The location bar view's class name. 82 // The location bar view's class name.
89 static const char kViewClassName[]; 83 static const char kViewClassName[];
90 84
91 // Returns the offset used during dropdown animation. 85 // Returns the offset used during dropdown animation.
92 int dropdown_animation_offset() const { return dropdown_animation_offset_; } 86 int dropdown_animation_offset() const { return dropdown_animation_offset_; }
93 87
94 class Delegate { 88 class Delegate {
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 239
246 // views::View: 240 // views::View:
247 bool HasFocus() const override; 241 bool HasFocus() const override;
248 void GetAccessibleState(ui::AXViewState* state) override; 242 void GetAccessibleState(ui::AXViewState* state) override;
249 gfx::Size GetPreferredSize() const override; 243 gfx::Size GetPreferredSize() const override;
250 void Layout() override; 244 void Layout() override;
251 245
252 // OmniboxEditController: 246 // OmniboxEditController:
253 void Update(const content::WebContents* contents) override; 247 void Update(const content::WebContents* contents) override;
254 void ShowURL() override; 248 void ShowURL() override;
255 void EndOriginChipAnimations(bool cancel_fade) override;
256 ToolbarModel* GetToolbarModel() override; 249 ToolbarModel* GetToolbarModel() override;
257 content::WebContents* GetWebContents() override; 250 content::WebContents* GetWebContents() override;
258 251
259 // Thickness of the edges of the omnibox background images, in normal mode. 252 // Thickness of the edges of the omnibox background images, in normal mode.
260 static const int kNormalEdgeThickness; 253 static const int kNormalEdgeThickness;
261 // The same, but for popup mode. 254 // The same, but for popup mode.
262 static const int kPopupEdgeThickness; 255 static const int kPopupEdgeThickness;
263 // Space between items in the location bar, as well as between items and the 256 // Space between items in the location bar, as well as between items and the
264 // edges. 257 // edges.
265 static const int kItemPadding; 258 static const int kItemPadding;
266 // Amount of padding built into the standard omnibox icons. 259 // Amount of padding built into the standard omnibox icons.
267 static const int kIconInternalPadding; 260 static const int kIconInternalPadding;
268 // Amount of padding to place between the origin chip and the leading edge of
269 // the location bar.
270 static const int kOriginChipEdgeItemPadding;
271 // Amount of padding built into the origin chip.
272 static const int kOriginChipBuiltinPadding;
273 // Space between the edge and a bubble. 261 // Space between the edge and a bubble.
274 static const int kBubblePadding; 262 static const int kBubblePadding;
275 263
276 private: 264 private:
277 typedef std::vector<ContentSettingImageView*> ContentSettingViews; 265 typedef std::vector<ContentSettingImageView*> ContentSettingViews;
278 266
279 friend class PageActionImageView; 267 friend class PageActionImageView;
280 friend class PageActionWithBadgeView; 268 friend class PageActionWithBadgeView;
281 typedef std::vector<ExtensionAction*> PageActions; 269 typedef std::vector<ExtensionAction*> PageActions;
282 typedef std::vector<PageActionWithBadgeView*> PageActionViews; 270 typedef std::vector<PageActionWithBadgeView*> PageActionViews;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 // Used to "reverse" the URL showing/hiding animations, since we use separate 316 // Used to "reverse" the URL showing/hiding animations, since we use separate
329 // animations whose curves are not true inverses of each other. Based on the 317 // animations whose curves are not true inverses of each other. Based on the
330 // current position of the omnibox, calculates what value the desired 318 // current position of the omnibox, calculates what value the desired
331 // animation (|hide_url_animation_| if |hide| is true, |show_url_animation_| 319 // animation (|hide_url_animation_| if |hide| is true, |show_url_animation_|
332 // if it's false) should be set to in order to produce the same omnibox 320 // if it's false) should be set to in order to produce the same omnibox
333 // position. This way we can stop the old animation, set the new animation to 321 // position. This way we can stop the old animation, set the new animation to
334 // this value, and start it running, and the text will appear to reverse 322 // this value, and start it running, and the text will appear to reverse
335 // directions from its current location. 323 // directions from its current location.
336 double GetValueForAnimation(bool hide) const; 324 double GetValueForAnimation(bool hide) const;
337 325
338 // Resets |show_url_animation_| and the color changes it causes.
339 void ResetShowAnimationAndColors();
340
341 // LocationBar: 326 // LocationBar:
342 void ShowFirstRunBubble() override; 327 void ShowFirstRunBubble() override;
343 GURL GetDestinationURL() const override; 328 GURL GetDestinationURL() const override;
344 WindowOpenDisposition GetWindowOpenDisposition() const override; 329 WindowOpenDisposition GetWindowOpenDisposition() const override;
345 ui::PageTransition GetPageTransition() const override; 330 ui::PageTransition GetPageTransition() const override;
346 void AcceptInput() override; 331 void AcceptInput() override;
347 void FocusSearch() override; 332 void FocusSearch() override;
348 void UpdateContentSettingsIcons() override; 333 void UpdateContentSettingsIcons() override;
349 void UpdateManagePasswordsIconAndBubble() override; 334 void UpdateManagePasswordsIconAndBubble() override;
350 void UpdatePageActions() override; 335 void UpdatePageActions() override;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 int GetDragOperationsForView(View* sender, const gfx::Point& p) override; 369 int GetDragOperationsForView(View* sender, const gfx::Point& p) override;
385 bool CanStartDragForView(View* sender, 370 bool CanStartDragForView(View* sender,
386 const gfx::Point& press_pt, 371 const gfx::Point& press_pt,
387 const gfx::Point& p) override; 372 const gfx::Point& p) override;
388 373
389 // OmniboxEditController: 374 // OmniboxEditController:
390 void OnChanged() override; 375 void OnChanged() override;
391 void OnSetFocus() override; 376 void OnSetFocus() override;
392 InstantController* GetInstant() override; 377 InstantController* GetInstant() override;
393 const ToolbarModel* GetToolbarModel() const override; 378 const ToolbarModel* GetToolbarModel() const override;
394 void HideURL() override;
395 379
396 // DropdownBarHostDelegate: 380 // DropdownBarHostDelegate:
397 void SetFocusAndSelection(bool select_all) override; 381 void SetFocusAndSelection(bool select_all) override;
398 void SetAnimationOffset(int offset) override; 382 void SetAnimationOffset(int offset) override;
399 383
400 // gfx::AnimationDelegate:
401 void AnimationProgressed(const gfx::Animation* animation) override;
402 void AnimationEnded(const gfx::Animation* animation) override;
403
404 // TemplateURLServiceObserver: 384 // TemplateURLServiceObserver:
405 void OnTemplateURLServiceChanged() override; 385 void OnTemplateURLServiceChanged() override;
406 386
407 // SearchModelObserver: 387 // SearchModelObserver:
408 void ModelChanged(const SearchModel::State& old_state, 388 void ModelChanged(const SearchModel::State& old_state,
409 const SearchModel::State& new_state) override; 389 const SearchModel::State& new_state) override;
410 390
411 // The Browser this LocationBarView is in. Note that at least 391 // The Browser this LocationBarView is in. Note that at least
412 // chromeos::SimpleWebViewDialog uses a LocationBarView outside any browser 392 // chromeos::SimpleWebViewDialog uses a LocationBarView outside any browser
413 // window, so this may be NULL. 393 // window, so this may be NULL.
414 Browser* browser_; 394 Browser* browser_;
415 395
416 OmniboxViewViews* omnibox_view_; 396 OmniboxViewViews* omnibox_view_;
417 397
418 // Our delegate. 398 // Our delegate.
419 Delegate* delegate_; 399 Delegate* delegate_;
420 400
421 // Object used to paint the border. 401 // Object used to paint the border.
422 scoped_ptr<views::Painter> border_painter_; 402 scoped_ptr<views::Painter> border_painter_;
423 403
424 // The origin chip that may appear in the location bar.
425 OriginChipView* origin_chip_view_;
426
427 // An icon to the left of the edit field. 404 // An icon to the left of the edit field.
428 LocationIconView* location_icon_view_; 405 LocationIconView* location_icon_view_;
429 406
430 // A bubble displayed for EV HTTPS sites. 407 // A bubble displayed for EV HTTPS sites.
431 EVBubbleView* ev_bubble_view_; 408 EVBubbleView* ev_bubble_view_;
432 409
433 // A view to show inline autocompletion when an IME is active. In this case, 410 // A view to show inline autocompletion when an IME is active. In this case,
434 // we shouldn't change the text or selection inside the OmniboxView itself, 411 // we shouldn't change the text or selection inside the OmniboxView itself,
435 // since this will conflict with the IME's control over the text. So instead 412 // since this will conflict with the IME's control over the text. So instead
436 // we show any autocompletion in a separate field after the OmniboxView. 413 // we show any autocompletion in a separate field after the OmniboxView.
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 476
500 // Tracks this preference to determine whether bookmark editing is allowed. 477 // Tracks this preference to determine whether bookmark editing is allowed.
501 BooleanPrefMember edit_bookmarks_enabled_; 478 BooleanPrefMember edit_bookmarks_enabled_;
502 479
503 // During dropdown animation, the host clips the widget and draws only the 480 // During dropdown animation, the host clips the widget and draws only the
504 // bottom part of it. The view needs to know the pixel offset at which we are 481 // bottom part of it. The view needs to know the pixel offset at which we are
505 // drawing the widget so that we can draw the curved edges that attach to the 482 // drawing the widget so that we can draw the curved edges that attach to the
506 // toolbar in the right location. 483 // toolbar in the right location.
507 int dropdown_animation_offset_; 484 int dropdown_animation_offset_;
508 485
509 // Origin chip animations.
510 //
511 // For the "show URL" animation, we instantly hide the origin chip and show
512 // the |omnibox_view_| in its place, containing the complete URL. However, we
513 // clip that view (using the XXX_leading_inset_ and XXX_width_ members) so
514 // that only the hostname is visible. We also offset the omnibox (using the
515 // XXX_offset_ members) so the hostname is in the same place as it was in the
516 // origin chip. Finally, we set the selection text and background color of
517 // the text to match the pressed origin chip. Then, as the animation runs,
518 // all of these values are animated to their steady-state values (no omnibox
519 // offset, no inset, width equal to the full omnibox text [which is reset to
520 // "no width clamp" after the animation ends], and standard selection colors).
521 //
522 // For the hide animation, we run the positioning and clipping parts of the
523 // animation in reverse, but instead of changing the selection color, because
524 // there usually isn't a selection when hiding, we leave the omnibox colors
525 // alone, and when the hide animation has ended, tell the origin chip to
526 // fade-in its background.
527 scoped_ptr<gfx::SlideAnimation> show_url_animation_;
528 scoped_ptr<gfx::SlideAnimation> hide_url_animation_;
529 // The omnibox offset may be positive or negative. The starting offset is the
530 // amount necessary to shift the |omnibox_view_| by such that the hostname
531 // portion of the URL aligns with the hostname in the origin chip. As the
532 // show animation runs, the current offset gradually moves to 0.
533 int starting_omnibox_offset_;
534 int current_omnibox_offset_;
535 // The leading inset is always positive. The starting inset is the width of 486 // The leading inset is always positive. The starting inset is the width of
536 // the text between the leading edge of the omnibox and the edge of the 487 // the text between the leading edge of the omnibox and the edge of the
537 // hostname, which is clipped off at the start of the show animation. Note 488 // hostname, which is clipped off at the start of the show animation. Note
538 // that in RTL mode, this will be the part of the URL that is logically after 489 // that in RTL mode, this will be the part of the URL that is logically after
539 // the hostname. As the show animation runs, the current inset gradually 490 // the hostname. As the show animation runs, the current inset gradually
540 // moves to 0. 491 // moves to 0.
541 int starting_omnibox_leading_inset_; 492 int starting_omnibox_leading_inset_;
Justin Donnelly 2014/11/21 19:15:24 These properties are no longer used.
542 int current_omnibox_leading_inset_; 493 int current_omnibox_leading_inset_;
543 // The width is always positive. The ending width is the width of the entire
544 // omnibox URL. As the show animation runs, the current width gradually moves
545 // from the width of the hostname to the ending value.
546 int current_omnibox_width_;
547 int ending_omnibox_width_;
548 494
549 DISALLOW_COPY_AND_ASSIGN(LocationBarView); 495 DISALLOW_COPY_AND_ASSIGN(LocationBarView);
550 }; 496 };
551 497
552 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_ 498 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698