OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h" | 5 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "chrome/browser/extensions/extension_message_bubble_controller.h" | 9 #include "chrome/browser/extensions/extension_message_bubble_controller.h" |
10 #include "chrome/browser/extensions/tab_helper.h" | 10 #include "chrome/browser/extensions/tab_helper.h" |
11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
| 13 #include "chrome/browser/ui/extensions/extension_toolbar_icon_surfacing_bubble_d
elegate.h" |
13 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 14 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
14 #include "chrome/browser/ui/toolbar/toolbar_action_view_controller.h" | 15 #include "chrome/browser/ui/toolbar/toolbar_action_view_controller.h" |
15 #include "chrome/browser/ui/toolbar/toolbar_actions_bar.h" | 16 #include "chrome/browser/ui/toolbar/toolbar_actions_bar.h" |
16 #include "chrome/browser/ui/view_ids.h" | 17 #include "chrome/browser/ui/view_ids.h" |
17 #include "chrome/browser/ui/views/extensions/browser_action_drag_data.h" | 18 #include "chrome/browser/ui/views/extensions/browser_action_drag_data.h" |
18 #include "chrome/browser/ui/views/extensions/extension_message_bubble_view.h" | 19 #include "chrome/browser/ui/views/extensions/extension_message_bubble_view.h" |
19 #include "chrome/browser/ui/views/extensions/extension_toolbar_icon_surfacing_bu
bble_views.h" | 20 #include "chrome/browser/ui/views/extensions/extension_toolbar_icon_surfacing_bu
bble_views.h" |
20 #include "chrome/browser/ui/views/frame/browser_view.h" | 21 #include "chrome/browser/ui/views/frame/browser_view.h" |
21 #include "chrome/browser/ui/views/toolbar/browser_actions_container_observer.h" | 22 #include "chrome/browser/ui/views/toolbar/browser_actions_container_observer.h" |
22 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" | 23 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 row_index * ToolbarActionsBar::IconHeight(), | 488 row_index * ToolbarActionsBar::IconHeight(), |
488 ToolbarActionsBar::IconWidth(false), | 489 ToolbarActionsBar::IconWidth(false), |
489 ToolbarActionsBar::IconHeight()); | 490 ToolbarActionsBar::IconHeight()); |
490 view->SetVisible(true); | 491 view->SetVisible(true); |
491 } | 492 } |
492 } | 493 } |
493 } | 494 } |
494 | 495 |
495 void BrowserActionsContainer::OnMouseEntered(const ui::MouseEvent& event) { | 496 void BrowserActionsContainer::OnMouseEntered(const ui::MouseEvent& event) { |
496 if (!shown_bubble_ && !toolbar_action_views_.empty() && | 497 if (!shown_bubble_ && !toolbar_action_views_.empty() && |
497 toolbar_actions_bar_->ShouldShowInfoBubble()) { | 498 ExtensionToolbarIconSurfacingBubbleDelegate::ShouldShowForProfile( |
| 499 browser_->profile())) { |
498 ExtensionToolbarIconSurfacingBubble* bubble = | 500 ExtensionToolbarIconSurfacingBubble* bubble = |
499 new ExtensionToolbarIconSurfacingBubble(toolbar_action_views_[0], | 501 new ExtensionToolbarIconSurfacingBubble( |
500 toolbar_actions_bar_.get()); | 502 toolbar_action_views_[0], |
| 503 make_scoped_ptr(new ExtensionToolbarIconSurfacingBubbleDelegate( |
| 504 browser_->profile()))); |
501 views::BubbleDelegateView::CreateBubble(bubble); | 505 views::BubbleDelegateView::CreateBubble(bubble); |
502 bubble->GetWidget()->Show(); | 506 bubble->Show(); |
503 } | 507 } |
504 shown_bubble_ = true; | 508 shown_bubble_ = true; |
505 } | 509 } |
506 | 510 |
507 bool BrowserActionsContainer::GetDropFormats( | 511 bool BrowserActionsContainer::GetDropFormats( |
508 int* formats, | 512 int* formats, |
509 std::set<OSExchangeData::CustomFormat>* custom_formats) { | 513 std::set<OSExchangeData::CustomFormat>* custom_formats) { |
510 return BrowserActionDragData::GetDropFormats(custom_formats); | 514 return BrowserActionDragData::GetDropFormats(custom_formats); |
511 } | 515 } |
512 | 516 |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
827 const int kImages[] = IMAGE_GRID(IDR_DEVELOPER_MODE_HIGHLIGHT); | 831 const int kImages[] = IMAGE_GRID(IDR_DEVELOPER_MODE_HIGHLIGHT); |
828 highlight_painter_.reset(views::Painter::CreateImageGridPainter(kImages)); | 832 highlight_painter_.reset(views::Painter::CreateImageGridPainter(kImages)); |
829 } | 833 } |
830 | 834 |
831 void BrowserActionsContainer::ClearActiveBubble(views::Widget* widget) { | 835 void BrowserActionsContainer::ClearActiveBubble(views::Widget* widget) { |
832 DCHECK(active_bubble_); | 836 DCHECK(active_bubble_); |
833 DCHECK_EQ(active_bubble_->GetWidget(), widget); | 837 DCHECK_EQ(active_bubble_->GetWidget(), widget); |
834 widget->RemoveObserver(this); | 838 widget->RemoveObserver(this); |
835 active_bubble_ = nullptr; | 839 active_bubble_ = nullptr; |
836 } | 840 } |
OLD | NEW |