OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/browser_actions_container.h" | 5 #include "chrome/browser/ui/views/browser_actions_container.h" |
6 | 6 |
7 #include "base/stl_util-inl.h" | 7 #include "base/stl_util-inl.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/browser_window.h" | 10 #include "chrome/browser/browser_window.h" |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 | 504 |
505 // We can get the execute event for browser actions that are not visible, | 505 // We can get the execute event for browser actions that are not visible, |
506 // since buttons can be activated from the overflow menu (chevron). In that | 506 // since buttons can be activated from the overflow menu (chevron). In that |
507 // case we show the popup as originating from the chevron. | 507 // case we show the popup as originating from the chevron. |
508 View* reference_view = button->parent()->IsVisible() ? button : chevron_; | 508 View* reference_view = button->parent()->IsVisible() ? button : chevron_; |
509 gfx::Point origin; | 509 gfx::Point origin; |
510 View::ConvertPointToScreen(reference_view, &origin); | 510 View::ConvertPointToScreen(reference_view, &origin); |
511 gfx::Rect rect = reference_view->bounds(); | 511 gfx::Rect rect = reference_view->bounds(); |
512 rect.set_origin(origin); | 512 rect.set_origin(origin); |
513 | 513 |
514 gfx::NativeWindow frame_window = browser_->window()->GetNativeHandle(); | |
515 BubbleBorder::ArrowLocation arrow_location = base::i18n::IsRTL() ? | 514 BubbleBorder::ArrowLocation arrow_location = base::i18n::IsRTL() ? |
516 BubbleBorder::TOP_LEFT : BubbleBorder::TOP_RIGHT; | 515 BubbleBorder::TOP_LEFT : BubbleBorder::TOP_RIGHT; |
517 | 516 |
518 popup_ = ExtensionPopup::Show(button->GetPopupUrl(), browser_, | 517 popup_ = ExtensionPopup::Show(button->GetPopupUrl(), browser_, rect, |
519 browser_->profile(), frame_window, rect, arrow_location, true, | 518 arrow_location, inspect_with_devtools, |
520 inspect_with_devtools, ExtensionPopup::BUBBLE_CHROME, this); | 519 this); |
521 popup_button_ = button; | 520 popup_button_ = button; |
522 popup_button_->SetButtonPushed(); | 521 popup_button_->SetButtonPushed(); |
523 } | 522 } |
524 | 523 |
525 gfx::Size BrowserActionsContainer::GetPreferredSize() { | 524 gfx::Size BrowserActionsContainer::GetPreferredSize() { |
526 if (browser_action_views_.empty()) | 525 if (browser_action_views_.empty()) |
527 return gfx::Size(ToolbarView::kStandardSpacing, 0); | 526 return gfx::Size(ToolbarView::kStandardSpacing, 0); |
528 | 527 |
529 // We calculate the size of the view by taking the current width and | 528 // We calculate the size of the view by taking the current width and |
530 // subtracting resize_amount_ (the latter represents how far the user is | 529 // subtracting resize_amount_ (the latter represents how far the user is |
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1096 AnimationEnded(resize_animation_.get()); | 1095 AnimationEnded(resize_animation_.get()); |
1097 } | 1096 } |
1098 } | 1097 } |
1099 | 1098 |
1100 bool BrowserActionsContainer::ShouldDisplayBrowserAction( | 1099 bool BrowserActionsContainer::ShouldDisplayBrowserAction( |
1101 const Extension* extension) { | 1100 const Extension* extension) { |
1102 // Only display incognito-enabled extensions while in incognito mode. | 1101 // Only display incognito-enabled extensions while in incognito mode. |
1103 return (!profile_->IsOffTheRecord() || | 1102 return (!profile_->IsOffTheRecord() || |
1104 profile_->GetExtensionService()->IsIncognitoEnabled(extension)); | 1103 profile_->GetExtensionService()->IsIncognitoEnabled(extension)); |
1105 } | 1104 } |
OLD | NEW |