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/ssl/security_state_model.h" | 14 #include "chrome/browser/ssl/security_state_model.h" |
15 #include "chrome/browser/ui/location_bar/location_bar.h" | 15 #include "chrome/browser/ui/location_bar/location_bar.h" |
16 #include "chrome/browser/ui/omnibox/chrome_omnibox_edit_controller.h" | 16 #include "chrome/browser/ui/omnibox/chrome_omnibox_edit_controller.h" |
| 17 #include "chrome/browser/ui/search/search_model_observer.h" |
17 #include "chrome/browser/ui/toolbar/chrome_toolbar_model.h" | 18 #include "chrome/browser/ui/toolbar/chrome_toolbar_model.h" |
18 #include "chrome/browser/ui/views/dropdown_bar_host.h" | 19 #include "chrome/browser/ui/views/dropdown_bar_host.h" |
19 #include "chrome/browser/ui/views/dropdown_bar_host_delegate.h" | 20 #include "chrome/browser/ui/views/dropdown_bar_host_delegate.h" |
20 #include "chrome/browser/ui/views/extensions/extension_popup.h" | 21 #include "chrome/browser/ui/views/extensions/extension_popup.h" |
21 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" | 22 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" |
22 #include "components/search_engines/template_url_service_observer.h" | 23 #include "components/search_engines/template_url_service_observer.h" |
23 #include "components/ui/zoom/zoom_event_manager_observer.h" | 24 #include "components/ui/zoom/zoom_event_manager_observer.h" |
24 #include "ui/gfx/animation/animation_delegate.h" | 25 #include "ui/gfx/animation/animation_delegate.h" |
25 #include "ui/gfx/animation/slide_animation.h" | 26 #include "ui/gfx/animation/slide_animation.h" |
26 #include "ui/gfx/font.h" | 27 #include "ui/gfx/font.h" |
27 #include "ui/gfx/geometry/rect.h" | 28 #include "ui/gfx/geometry/rect.h" |
| 29 #include "ui/views/controls/button/button.h" |
28 #include "ui/views/drag_controller.h" | 30 #include "ui/views/drag_controller.h" |
29 | 31 |
30 class ActionBoxButtonView; | 32 class ActionBoxButtonView; |
31 class CommandUpdater; | 33 class CommandUpdater; |
32 class ContentSettingBubbleModelDelegate; | 34 class ContentSettingBubbleModelDelegate; |
33 class ContentSettingImageView; | 35 class ContentSettingImageView; |
34 class EVBubbleView; | 36 class EVBubbleView; |
35 class ExtensionAction; | 37 class ExtensionAction; |
36 class GURL; | 38 class GURL; |
37 class InstantController; | 39 class InstantController; |
38 class KeywordHintView; | 40 class KeywordHintView; |
39 class LocationIconView; | 41 class LocationIconView; |
40 class OpenPDFInReaderView; | 42 class OpenPDFInReaderView; |
41 class ManagePasswordsIconViews; | 43 class ManagePasswordsIconViews; |
42 class PageActionWithBadgeView; | 44 class PageActionWithBadgeView; |
43 class PageActionImageView; | 45 class PageActionImageView; |
44 class Profile; | 46 class Profile; |
45 class SelectedKeywordView; | 47 class SelectedKeywordView; |
46 class StarView; | 48 class StarView; |
47 class TemplateURLService; | 49 class TemplateURLService; |
48 class TranslateIconView; | 50 class TranslateIconView; |
49 class ZoomView; | 51 class ZoomView; |
50 | 52 |
51 namespace autofill { | 53 namespace autofill { |
52 class SaveCardIconView; | 54 class SaveCardIconView; |
53 } | 55 } |
54 | 56 |
55 namespace views { | 57 namespace views { |
56 class BubbleDelegateView; | 58 class BubbleDelegateView; |
| 59 class ImageButton; |
| 60 class ImageView; |
57 class Label; | 61 class Label; |
58 class Widget; | 62 class Widget; |
59 } | 63 } |
60 | 64 |
61 ///////////////////////////////////////////////////////////////////////////// | 65 ///////////////////////////////////////////////////////////////////////////// |
62 // | 66 // |
63 // LocationBarView class | 67 // LocationBarView class |
64 // | 68 // |
65 // The LocationBarView class is a View subclass that paints the background | 69 // The LocationBarView class is a View subclass that paints the background |
66 // of the URL bar strip and contains its content. | 70 // of the URL bar strip and contains its content. |
67 // | 71 // |
68 ///////////////////////////////////////////////////////////////////////////// | 72 ///////////////////////////////////////////////////////////////////////////// |
69 class LocationBarView : public LocationBar, | 73 class LocationBarView : public LocationBar, |
70 public LocationBarTesting, | 74 public LocationBarTesting, |
71 public views::View, | 75 public views::View, |
| 76 public views::ButtonListener, |
72 public views::DragController, | 77 public views::DragController, |
73 public gfx::AnimationDelegate, | 78 public gfx::AnimationDelegate, |
74 public ChromeOmniboxEditController, | 79 public ChromeOmniboxEditController, |
75 public DropdownBarHostDelegate, | 80 public DropdownBarHostDelegate, |
76 public TemplateURLServiceObserver, | 81 public TemplateURLServiceObserver, |
| 82 public SearchModelObserver, |
77 public ui_zoom::ZoomEventManagerObserver { | 83 public ui_zoom::ZoomEventManagerObserver { |
78 public: | 84 public: |
79 // The location bar view's class name. | 85 // The location bar view's class name. |
80 static const char kViewClassName[]; | 86 static const char kViewClassName[]; |
81 | 87 |
82 // Returns the offset used during dropdown animation. | 88 // Returns the offset used during dropdown animation. |
83 int dropdown_animation_offset() const { return dropdown_animation_offset_; } | 89 int dropdown_animation_offset() const { return dropdown_animation_offset_; } |
84 | 90 |
85 class Delegate { | 91 class Delegate { |
86 public: | 92 public: |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 void TestPageActionPressed(size_t index) override; | 366 void TestPageActionPressed(size_t index) override; |
361 bool GetBookmarkStarVisibility() override; | 367 bool GetBookmarkStarVisibility() override; |
362 | 368 |
363 // views::View: | 369 // views::View: |
364 const char* GetClassName() const override; | 370 const char* GetClassName() const override; |
365 void OnBoundsChanged(const gfx::Rect& previous_bounds) override; | 371 void OnBoundsChanged(const gfx::Rect& previous_bounds) override; |
366 void OnFocus() override; | 372 void OnFocus() override; |
367 void OnPaint(gfx::Canvas* canvas) override; | 373 void OnPaint(gfx::Canvas* canvas) override; |
368 void PaintChildren(const ui::PaintContext& context) override; | 374 void PaintChildren(const ui::PaintContext& context) override; |
369 | 375 |
| 376 // views::ButtonListener: |
| 377 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
| 378 |
370 // views::DragController: | 379 // views::DragController: |
371 void WriteDragDataForView(View* sender, | 380 void WriteDragDataForView(View* sender, |
372 const gfx::Point& press_pt, | 381 const gfx::Point& press_pt, |
373 OSExchangeData* data) override; | 382 OSExchangeData* data) override; |
374 int GetDragOperationsForView(View* sender, const gfx::Point& p) override; | 383 int GetDragOperationsForView(View* sender, const gfx::Point& p) override; |
375 bool CanStartDragForView(View* sender, | 384 bool CanStartDragForView(View* sender, |
376 const gfx::Point& press_pt, | 385 const gfx::Point& press_pt, |
377 const gfx::Point& p) override; | 386 const gfx::Point& p) override; |
378 | 387 |
379 // gfx::AnimationDelegate: | 388 // gfx::AnimationDelegate: |
380 void AnimationProgressed(const gfx::Animation* animation) override; | 389 void AnimationProgressed(const gfx::Animation* animation) override; |
381 void AnimationEnded(const gfx::Animation* animation) override; | 390 void AnimationEnded(const gfx::Animation* animation) override; |
382 | 391 |
383 // ChromeOmniboxEditController: | 392 // ChromeOmniboxEditController: |
384 void OnChanged() override; | 393 void OnChanged() override; |
385 void OnSetFocus() override; | 394 void OnSetFocus() override; |
386 const ToolbarModel* GetToolbarModel() const override; | 395 const ToolbarModel* GetToolbarModel() const override; |
387 | 396 |
388 // DropdownBarHostDelegate: | 397 // DropdownBarHostDelegate: |
389 void SetFocusAndSelection(bool select_all) override; | 398 void SetFocusAndSelection(bool select_all) override; |
390 void SetAnimationOffset(int offset) override; | 399 void SetAnimationOffset(int offset) override; |
391 | 400 |
392 // TemplateURLServiceObserver: | 401 // TemplateURLServiceObserver: |
393 void OnTemplateURLServiceChanged() override; | 402 void OnTemplateURLServiceChanged() override; |
394 | 403 |
| 404 // SearchModelObserver: |
| 405 void ModelChanged(const SearchModel::State& old_state, |
| 406 const SearchModel::State& new_state) override; |
| 407 |
395 // The Browser this LocationBarView is in. Note that at least | 408 // The Browser this LocationBarView is in. Note that at least |
396 // chromeos::SimpleWebViewDialog uses a LocationBarView outside any browser | 409 // chromeos::SimpleWebViewDialog uses a LocationBarView outside any browser |
397 // window, so this may be NULL. | 410 // window, so this may be NULL. |
398 Browser* browser_; | 411 Browser* browser_; |
399 | 412 |
400 OmniboxViewViews* omnibox_view_; | 413 OmniboxViewViews* omnibox_view_; |
401 | 414 |
402 // Our delegate. | 415 // Our delegate. |
403 Delegate* delegate_; | 416 Delegate* delegate_; |
404 | 417 |
(...skipping 21 matching lines...) Expand all Loading... |
426 // Shown if the user has selected a keyword. | 439 // Shown if the user has selected a keyword. |
427 SelectedKeywordView* selected_keyword_view_; | 440 SelectedKeywordView* selected_keyword_view_; |
428 | 441 |
429 // View responsible for showing suggested text. This is NULL when there is no | 442 // View responsible for showing suggested text. This is NULL when there is no |
430 // suggested text. | 443 // suggested text. |
431 views::Label* suggested_text_view_; | 444 views::Label* suggested_text_view_; |
432 | 445 |
433 // Shown if the selected url has a corresponding keyword. | 446 // Shown if the selected url has a corresponding keyword. |
434 KeywordHintView* keyword_hint_view_; | 447 KeywordHintView* keyword_hint_view_; |
435 | 448 |
| 449 // The voice search icon. |
| 450 views::ImageButton* mic_search_view_; |
| 451 |
436 // The content setting views. | 452 // The content setting views. |
437 ContentSettingViews content_setting_views_; | 453 ContentSettingViews content_setting_views_; |
438 | 454 |
439 // The zoom icon. | 455 // The zoom icon. |
440 ZoomView* zoom_view_; | 456 ZoomView* zoom_view_; |
441 | 457 |
442 // The icon to open a PDF in Reader. | 458 // The icon to open a PDF in Reader. |
443 OpenPDFInReaderView* open_pdf_in_reader_view_; | 459 OpenPDFInReaderView* open_pdf_in_reader_view_; |
444 | 460 |
445 // The manage passwords icon. | 461 // The manage passwords icon. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 int dropdown_animation_offset_; | 498 int dropdown_animation_offset_; |
483 | 499 |
484 // This is a debug state variable that stores if the WebContents was null | 500 // This is a debug state variable that stores if the WebContents was null |
485 // during the last RefreshPageAction. | 501 // during the last RefreshPageAction. |
486 bool web_contents_null_at_last_refresh_; | 502 bool web_contents_null_at_last_refresh_; |
487 | 503 |
488 DISALLOW_COPY_AND_ASSIGN(LocationBarView); | 504 DISALLOW_COPY_AND_ASSIGN(LocationBarView); |
489 }; | 505 }; |
490 | 506 |
491 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_ | 507 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_ |
OLD | NEW |