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

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: Fix bad merge Created 5 years, 11 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 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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 242
249 // views::View: 243 // views::View:
250 bool HasFocus() const override; 244 bool HasFocus() const override;
251 void GetAccessibleState(ui::AXViewState* state) override; 245 void GetAccessibleState(ui::AXViewState* state) override;
252 gfx::Size GetPreferredSize() const override; 246 gfx::Size GetPreferredSize() const override;
253 void Layout() override; 247 void Layout() override;
254 248
255 // OmniboxEditController: 249 // OmniboxEditController:
256 void Update(const content::WebContents* contents) override; 250 void Update(const content::WebContents* contents) override;
257 void ShowURL() override; 251 void ShowURL() override;
258 void EndOriginChipAnimations(bool cancel_fade) override;
259 ToolbarModel* GetToolbarModel() override; 252 ToolbarModel* GetToolbarModel() override;
260 content::WebContents* GetWebContents() override; 253 content::WebContents* GetWebContents() override;
261 254
262 // Thickness of the edges of the omnibox background images, in normal mode. 255 // Thickness of the edges of the omnibox background images, in normal mode.
263 static const int kNormalEdgeThickness; 256 static const int kNormalEdgeThickness;
264 // The same, but for popup mode. 257 // The same, but for popup mode.
265 static const int kPopupEdgeThickness; 258 static const int kPopupEdgeThickness;
266 // Space between items in the location bar, as well as between items and the 259 // Space between items in the location bar, as well as between items and the
267 // edges. 260 // edges.
268 static const int kItemPadding; 261 static const int kItemPadding;
269 // Amount of padding built into the standard omnibox icons. 262 // Amount of padding built into the standard omnibox icons.
270 static const int kIconInternalPadding; 263 static const int kIconInternalPadding;
271 // Amount of padding to place between the origin chip and the leading edge of
272 // the location bar.
273 static const int kOriginChipEdgeItemPadding;
274 // Amount of padding built into the origin chip.
275 static const int kOriginChipBuiltinPadding;
276 // Space between the edge and a bubble. 264 // Space between the edge and a bubble.
277 static const int kBubblePadding; 265 static const int kBubblePadding;
278 266
279 private: 267 private:
280 typedef std::vector<ContentSettingImageView*> ContentSettingViews; 268 typedef std::vector<ContentSettingImageView*> ContentSettingViews;
281 269
282 friend class PageActionImageView; 270 friend class PageActionImageView;
283 friend class PageActionWithBadgeView; 271 friend class PageActionWithBadgeView;
284 typedef std::vector<ExtensionAction*> PageActions; 272 typedef std::vector<ExtensionAction*> PageActions;
285 typedef std::vector<PageActionWithBadgeView*> PageActionViews; 273 typedef std::vector<PageActionWithBadgeView*> PageActionViews;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 // Used to "reverse" the URL showing/hiding animations, since we use separate 324 // Used to "reverse" the URL showing/hiding animations, since we use separate
337 // animations whose curves are not true inverses of each other. Based on the 325 // animations whose curves are not true inverses of each other. Based on the
338 // current position of the omnibox, calculates what value the desired 326 // current position of the omnibox, calculates what value the desired
339 // animation (|hide_url_animation_| if |hide| is true, |show_url_animation_| 327 // animation (|hide_url_animation_| if |hide| is true, |show_url_animation_|
340 // if it's false) should be set to in order to produce the same omnibox 328 // if it's false) should be set to in order to produce the same omnibox
341 // position. This way we can stop the old animation, set the new animation to 329 // position. This way we can stop the old animation, set the new animation to
342 // this value, and start it running, and the text will appear to reverse 330 // this value, and start it running, and the text will appear to reverse
343 // directions from its current location. 331 // directions from its current location.
344 double GetValueForAnimation(bool hide) const; 332 double GetValueForAnimation(bool hide) const;
345 333
346 // Resets |show_url_animation_| and the color changes it causes.
347 void ResetShowAnimationAndColors();
348
349 // LocationBar: 334 // LocationBar:
350 void ShowFirstRunBubble() override; 335 void ShowFirstRunBubble() override;
351 GURL GetDestinationURL() const override; 336 GURL GetDestinationURL() const override;
352 WindowOpenDisposition GetWindowOpenDisposition() const override; 337 WindowOpenDisposition GetWindowOpenDisposition() const override;
353 ui::PageTransition GetPageTransition() const override; 338 ui::PageTransition GetPageTransition() const override;
354 void AcceptInput() override; 339 void AcceptInput() override;
355 void FocusSearch() override; 340 void FocusSearch() override;
356 void UpdateContentSettingsIcons() override; 341 void UpdateContentSettingsIcons() override;
357 void UpdateManagePasswordsIconAndBubble() override; 342 void UpdateManagePasswordsIconAndBubble() override;
358 void UpdatePageActions() override; 343 void UpdatePageActions() override;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 int GetDragOperationsForView(View* sender, const gfx::Point& p) override; 376 int GetDragOperationsForView(View* sender, const gfx::Point& p) override;
392 bool CanStartDragForView(View* sender, 377 bool CanStartDragForView(View* sender,
393 const gfx::Point& press_pt, 378 const gfx::Point& press_pt,
394 const gfx::Point& p) override; 379 const gfx::Point& p) override;
395 380
396 // OmniboxEditController: 381 // OmniboxEditController:
397 void OnChanged() override; 382 void OnChanged() override;
398 void OnSetFocus() override; 383 void OnSetFocus() override;
399 InstantController* GetInstant() override; 384 InstantController* GetInstant() override;
400 const ToolbarModel* GetToolbarModel() const override; 385 const ToolbarModel* GetToolbarModel() const override;
401 void HideURL() override;
402 386
403 // DropdownBarHostDelegate: 387 // DropdownBarHostDelegate:
404 void SetFocusAndSelection(bool select_all) override; 388 void SetFocusAndSelection(bool select_all) override;
405 void SetAnimationOffset(int offset) override; 389 void SetAnimationOffset(int offset) override;
406 390
407 // gfx::AnimationDelegate:
408 void AnimationProgressed(const gfx::Animation* animation) override;
409 void AnimationEnded(const gfx::Animation* animation) override;
410
411 // TemplateURLServiceObserver: 391 // TemplateURLServiceObserver:
412 void OnTemplateURLServiceChanged() override; 392 void OnTemplateURLServiceChanged() override;
413 393
414 // SearchModelObserver: 394 // SearchModelObserver:
415 void ModelChanged(const SearchModel::State& old_state, 395 void ModelChanged(const SearchModel::State& old_state,
416 const SearchModel::State& new_state) override; 396 const SearchModel::State& new_state) override;
417 397
418 // The Browser this LocationBarView is in. Note that at least 398 // The Browser this LocationBarView is in. Note that at least
419 // chromeos::SimpleWebViewDialog uses a LocationBarView outside any browser 399 // chromeos::SimpleWebViewDialog uses a LocationBarView outside any browser
420 // window, so this may be NULL. 400 // window, so this may be NULL.
421 Browser* browser_; 401 Browser* browser_;
422 402
423 OmniboxViewViews* omnibox_view_; 403 OmniboxViewViews* omnibox_view_;
424 404
425 // Our delegate. 405 // Our delegate.
426 Delegate* delegate_; 406 Delegate* delegate_;
427 407
428 // Object used to paint the border. 408 // Object used to paint the border.
429 scoped_ptr<views::Painter> border_painter_; 409 scoped_ptr<views::Painter> border_painter_;
430 410
431 // The origin chip that may appear in the location bar.
432 OriginChipView* origin_chip_view_;
433
434 // An icon to the left of the edit field. 411 // An icon to the left of the edit field.
435 LocationIconView* location_icon_view_; 412 LocationIconView* location_icon_view_;
436 413
437 // A bubble displayed for EV HTTPS sites. 414 // A bubble displayed for EV HTTPS sites.
438 EVBubbleView* ev_bubble_view_; 415 EVBubbleView* ev_bubble_view_;
439 416
440 // A view to show inline autocompletion when an IME is active. In this case, 417 // A view to show inline autocompletion when an IME is active. In this case,
441 // we shouldn't change the text or selection inside the OmniboxView itself, 418 // we shouldn't change the text or selection inside the OmniboxView itself,
442 // since this will conflict with the IME's control over the text. So instead 419 // since this will conflict with the IME's control over the text. So instead
443 // we show any autocompletion in a separate field after the OmniboxView. 420 // we show any autocompletion in a separate field after the OmniboxView.
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 480
504 // Tracks this preference to determine whether bookmark editing is allowed. 481 // Tracks this preference to determine whether bookmark editing is allowed.
505 BooleanPrefMember edit_bookmarks_enabled_; 482 BooleanPrefMember edit_bookmarks_enabled_;
506 483
507 // During dropdown animation, the host clips the widget and draws only the 484 // During dropdown animation, the host clips the widget and draws only the
508 // bottom part of it. The view needs to know the pixel offset at which we are 485 // bottom part of it. The view needs to know the pixel offset at which we are
509 // drawing the widget so that we can draw the curved edges that attach to the 486 // drawing the widget so that we can draw the curved edges that attach to the
510 // toolbar in the right location. 487 // toolbar in the right location.
511 int dropdown_animation_offset_; 488 int dropdown_animation_offset_;
512 489
513 // Origin chip animations.
514 //
515 // For the "show URL" animation, we instantly hide the origin chip and show
516 // the |omnibox_view_| in its place, containing the complete URL. However, we
517 // clip that view (using the XXX_leading_inset_ and XXX_width_ members) so
518 // that only the hostname is visible. We also offset the omnibox (using the
519 // XXX_offset_ members) so the hostname is in the same place as it was in the
520 // origin chip. Finally, we set the selection text and background color of
521 // the text to match the pressed origin chip. Then, as the animation runs,
522 // all of these values are animated to their steady-state values (no omnibox
523 // offset, no inset, width equal to the full omnibox text [which is reset to
524 // "no width clamp" after the animation ends], and standard selection colors).
525 //
526 // For the hide animation, we run the positioning and clipping parts of the
527 // animation in reverse, but instead of changing the selection color, because
528 // there usually isn't a selection when hiding, we leave the omnibox colors
529 // alone, and when the hide animation has ended, tell the origin chip to
530 // fade-in its background.
531 scoped_ptr<gfx::SlideAnimation> show_url_animation_;
532 scoped_ptr<gfx::SlideAnimation> hide_url_animation_;
533 // The omnibox offset may be positive or negative. The starting offset is the
534 // amount necessary to shift the |omnibox_view_| by such that the hostname
535 // portion of the URL aligns with the hostname in the origin chip. As the
536 // show animation runs, the current offset gradually moves to 0.
537 int starting_omnibox_offset_;
538 int current_omnibox_offset_;
539 // The leading inset is always positive. The starting inset is the width of
540 // the text between the leading edge of the omnibox and the edge of the
541 // hostname, which is clipped off at the start of the show animation. Note
542 // that in RTL mode, this will be the part of the URL that is logically after
543 // the hostname. As the show animation runs, the current inset gradually
544 // moves to 0.
545 int starting_omnibox_leading_inset_;
546 int current_omnibox_leading_inset_;
547 // The width is always positive. The ending width is the width of the entire
548 // omnibox URL. As the show animation runs, the current width gradually moves
549 // from the width of the hostname to the ending value.
550 int current_omnibox_width_;
551 int ending_omnibox_width_;
552
553 // This is a debug state variable that stores if the WebContents was null 490 // This is a debug state variable that stores if the WebContents was null
554 // during the last RefreshPageAction. 491 // during the last RefreshPageAction.
555 bool web_contents_null_at_last_refresh_; 492 bool web_contents_null_at_last_refresh_;
556 493
557 DISALLOW_COPY_AND_ASSIGN(LocationBarView); 494 DISALLOW_COPY_AND_ASSIGN(LocationBarView);
558 }; 495 };
559 496
560 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_ 497 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698