OLD | NEW |
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 |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/prefs/pref_member.h" | 12 #include "base/prefs/pref_member.h" |
13 #include "chrome/browser/extensions/extension_context_menu_model.h" | 13 #include "chrome/browser/extensions/extension_context_menu_model.h" |
14 #include "chrome/browser/ui/location_bar/location_bar.h" | 14 #include "chrome/browser/ui/location_bar/location_bar.h" |
15 #include "chrome/browser/ui/omnibox/omnibox_edit_controller.h" | 15 #include "chrome/browser/ui/omnibox/omnibox_edit_controller.h" |
16 #include "chrome/browser/ui/search/search_model_observer.h" | 16 #include "chrome/browser/ui/search/search_model_observer.h" |
17 #include "chrome/browser/ui/toolbar/toolbar_model.h" | 17 #include "chrome/browser/ui/toolbar/toolbar_model.h" |
18 #include "chrome/browser/ui/views/dropdown_bar_host.h" | 18 #include "chrome/browser/ui/views/dropdown_bar_host.h" |
19 #include "chrome/browser/ui/views/dropdown_bar_host_delegate.h" | 19 #include "chrome/browser/ui/views/dropdown_bar_host_delegate.h" |
20 #include "chrome/browser/ui/views/extensions/extension_popup.h" | 20 #include "chrome/browser/ui/views/extensions/extension_popup.h" |
21 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" | 21 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" |
22 #include "components/search_engines/template_url_service_observer.h" | 22 #include "components/search_engines/template_url_service_observer.h" |
23 #include "components/ui/zoom/zoom_event_manager_observer.h" | 23 #include "components/ui/zoom/zoom_event_manager_observer.h" |
24 #include "ui/gfx/animation/animation_delegate.h" | 24 #include "ui/gfx/animation/animation_delegate.h" |
| 25 #include "ui/gfx/animation/slide_animation.h" |
25 #include "ui/gfx/font.h" | 26 #include "ui/gfx/font.h" |
26 #include "ui/gfx/geometry/rect.h" | 27 #include "ui/gfx/geometry/rect.h" |
27 #include "ui/views/controls/button/button.h" | 28 #include "ui/views/controls/button/button.h" |
28 #include "ui/views/drag_controller.h" | 29 #include "ui/views/drag_controller.h" |
29 | 30 |
30 class ActionBoxButtonView; | 31 class ActionBoxButtonView; |
31 class CommandUpdater; | 32 class CommandUpdater; |
32 class ContentSettingBubbleModelDelegate; | 33 class ContentSettingBubbleModelDelegate; |
33 class ContentSettingImageView; | 34 class ContentSettingImageView; |
34 class EVBubbleView; | 35 class EVBubbleView; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 // | 68 // |
68 // The LocationBarView class is a View subclass that paints the background | 69 // The LocationBarView class is a View subclass that paints the background |
69 // of the URL bar strip and contains its content. | 70 // of the URL bar strip and contains its content. |
70 // | 71 // |
71 ///////////////////////////////////////////////////////////////////////////// | 72 ///////////////////////////////////////////////////////////////////////////// |
72 class LocationBarView : public LocationBar, | 73 class LocationBarView : public LocationBar, |
73 public LocationBarTesting, | 74 public LocationBarTesting, |
74 public views::View, | 75 public views::View, |
75 public views::ButtonListener, | 76 public views::ButtonListener, |
76 public views::DragController, | 77 public views::DragController, |
| 78 public gfx::AnimationDelegate, |
77 public OmniboxEditController, | 79 public OmniboxEditController, |
78 public DropdownBarHostDelegate, | 80 public DropdownBarHostDelegate, |
79 public TemplateURLServiceObserver, | 81 public TemplateURLServiceObserver, |
80 public SearchModelObserver, | 82 public SearchModelObserver, |
81 public ui_zoom::ZoomEventManagerObserver { | 83 public ui_zoom::ZoomEventManagerObserver { |
82 public: | 84 public: |
83 // The location bar view's class name. | 85 // The location bar view's class name. |
84 static const char kViewClassName[]; | 86 static const char kViewClassName[]; |
85 | 87 |
86 // Returns the offset used during dropdown animation. | 88 // Returns the offset used during dropdown animation. |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 void ShowFirstRunBubble() override; | 342 void ShowFirstRunBubble() override; |
341 GURL GetDestinationURL() const override; | 343 GURL GetDestinationURL() const override; |
342 WindowOpenDisposition GetWindowOpenDisposition() const override; | 344 WindowOpenDisposition GetWindowOpenDisposition() const override; |
343 ui::PageTransition GetPageTransition() const override; | 345 ui::PageTransition GetPageTransition() const override; |
344 void AcceptInput() override; | 346 void AcceptInput() override; |
345 void FocusSearch() override; | 347 void FocusSearch() override; |
346 void UpdateContentSettingsIcons() override; | 348 void UpdateContentSettingsIcons() override; |
347 void UpdateManagePasswordsIconAndBubble() override; | 349 void UpdateManagePasswordsIconAndBubble() override; |
348 void UpdatePageActions() override; | 350 void UpdatePageActions() override; |
349 void UpdateBookmarkStarVisibility() override; | 351 void UpdateBookmarkStarVisibility() override; |
| 352 void UpdateLocationBarVisibility(bool visible, bool animation) override; |
350 bool ShowPageActionPopup(const extensions::Extension* extension, | 353 bool ShowPageActionPopup(const extensions::Extension* extension, |
351 bool grant_active_tab) override; | 354 bool grant_active_tab) override; |
352 void UpdateOpenPDFInReaderPrompt() override; | 355 void UpdateOpenPDFInReaderPrompt() override; |
353 void UpdateGeneratedCreditCardView() override; | 356 void UpdateGeneratedCreditCardView() override; |
354 void SaveStateToContents(content::WebContents* contents) override; | 357 void SaveStateToContents(content::WebContents* contents) override; |
355 const OmniboxView* GetOmniboxView() const override; | 358 const OmniboxView* GetOmniboxView() const override; |
356 LocationBarTesting* GetLocationBarForTesting() override; | 359 LocationBarTesting* GetLocationBarForTesting() override; |
357 | 360 |
358 // LocationBarTesting: | 361 // LocationBarTesting: |
359 int PageActionCount() override; | 362 int PageActionCount() override; |
(...skipping 15 matching lines...) Expand all Loading... |
375 | 378 |
376 // views::DragController: | 379 // views::DragController: |
377 void WriteDragDataForView(View* sender, | 380 void WriteDragDataForView(View* sender, |
378 const gfx::Point& press_pt, | 381 const gfx::Point& press_pt, |
379 OSExchangeData* data) override; | 382 OSExchangeData* data) override; |
380 int GetDragOperationsForView(View* sender, const gfx::Point& p) override; | 383 int GetDragOperationsForView(View* sender, const gfx::Point& p) override; |
381 bool CanStartDragForView(View* sender, | 384 bool CanStartDragForView(View* sender, |
382 const gfx::Point& press_pt, | 385 const gfx::Point& press_pt, |
383 const gfx::Point& p) override; | 386 const gfx::Point& p) override; |
384 | 387 |
| 388 // gfx::AnimationDelegate: |
| 389 void AnimationProgressed(const gfx::Animation* animation) override; |
| 390 void AnimationEnded(const gfx::Animation* animation) override; |
| 391 |
385 // OmniboxEditController: | 392 // OmniboxEditController: |
386 void OnChanged() override; | 393 void OnChanged() override; |
387 void OnSetFocus() override; | 394 void OnSetFocus() override; |
388 InstantController* GetInstant() override; | 395 InstantController* GetInstant() override; |
389 const ToolbarModel* GetToolbarModel() const override; | 396 const ToolbarModel* GetToolbarModel() const override; |
390 | 397 |
391 // DropdownBarHostDelegate: | 398 // DropdownBarHostDelegate: |
392 void SetFocusAndSelection(bool select_all) override; | 399 void SetFocusAndSelection(bool select_all) override; |
393 void SetAnimationOffset(int offset) override; | 400 void SetAnimationOffset(int offset) override; |
394 | 401 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 | 467 |
461 // The page action icon views. | 468 // The page action icon views. |
462 PageActionViews page_action_views_; | 469 PageActionViews page_action_views_; |
463 | 470 |
464 // The icon for Translate. | 471 // The icon for Translate. |
465 TranslateIconView* translate_icon_view_; | 472 TranslateIconView* translate_icon_view_; |
466 | 473 |
467 // The star. | 474 // The star. |
468 StarView* star_view_; | 475 StarView* star_view_; |
469 | 476 |
| 477 // Animation to control showing / hiding the location bar. |
| 478 gfx::SlideAnimation size_animation_; |
| 479 |
470 // Whether we're in popup mode. This value also controls whether the location | 480 // Whether we're in popup mode. This value also controls whether the location |
471 // bar is read-only. | 481 // bar is read-only. |
472 const bool is_popup_mode_; | 482 const bool is_popup_mode_; |
473 | 483 |
474 // True if we should show a focus rect while the location entry field is | 484 // True if we should show a focus rect while the location entry field is |
475 // focused. Used when the toolbar is in full keyboard accessibility mode. | 485 // focused. Used when the toolbar is in full keyboard accessibility mode. |
476 bool show_focus_rect_; | 486 bool show_focus_rect_; |
477 | 487 |
478 // This is in case we're destroyed before the model loads. We need to make | 488 // This is in case we're destroyed before the model loads. We need to make |
479 // Add/RemoveObserver calls. | 489 // Add/RemoveObserver calls. |
480 TemplateURLService* template_url_service_; | 490 TemplateURLService* template_url_service_; |
481 | 491 |
482 // Tracks this preference to determine whether bookmark editing is allowed. | 492 // Tracks this preference to determine whether bookmark editing is allowed. |
483 BooleanPrefMember edit_bookmarks_enabled_; | 493 BooleanPrefMember edit_bookmarks_enabled_; |
484 | 494 |
485 // During dropdown animation, the host clips the widget and draws only the | 495 // During dropdown animation, the host clips the widget and draws only the |
486 // bottom part of it. The view needs to know the pixel offset at which we are | 496 // bottom part of it. The view needs to know the pixel offset at which we are |
487 // drawing the widget so that we can draw the curved edges that attach to the | 497 // drawing the widget so that we can draw the curved edges that attach to the |
488 // toolbar in the right location. | 498 // toolbar in the right location. |
489 int dropdown_animation_offset_; | 499 int dropdown_animation_offset_; |
490 | 500 |
491 // This is a debug state variable that stores if the WebContents was null | 501 // This is a debug state variable that stores if the WebContents was null |
492 // during the last RefreshPageAction. | 502 // during the last RefreshPageAction. |
493 bool web_contents_null_at_last_refresh_; | 503 bool web_contents_null_at_last_refresh_; |
494 | 504 |
495 DISALLOW_COPY_AND_ASSIGN(LocationBarView); | 505 DISALLOW_COPY_AND_ASSIGN(LocationBarView); |
496 }; | 506 }; |
497 | 507 |
498 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_ | 508 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_ |
OLD | NEW |