| 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 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(); | 514 gfx::NativeWindow frame_window = browser_->window()->GetNativeHandle(); |
| 515 BubbleBorder::ArrowLocation arrow_location = base::i18n::IsRTL() ? | 515 BubbleBorder::ArrowLocation arrow_location = base::i18n::IsRTL() ? |
| 516 BubbleBorder::TOP_LEFT : BubbleBorder::TOP_RIGHT; | 516 BubbleBorder::TOP_LEFT : BubbleBorder::TOP_RIGHT; |
| 517 | 517 |
| 518 popup_ = ExtensionPopup::Show(button->GetPopupUrl(), browser_, | 518 popup_ = ExtensionPopup::Show(button->GetPopupUrl(), browser_, |
| 519 browser_->profile(), frame_window, rect, arrow_location, true, | 519 browser_->profile(), frame_window, rect, arrow_location, |
| 520 inspect_with_devtools, ExtensionPopup::BUBBLE_CHROME, this); | 520 inspect_with_devtools, this); |
| 521 popup_button_ = button; | 521 popup_button_ = button; |
| 522 popup_button_->SetButtonPushed(); | 522 popup_button_->SetButtonPushed(); |
| 523 } | 523 } |
| 524 | 524 |
| 525 gfx::Size BrowserActionsContainer::GetPreferredSize() { | 525 gfx::Size BrowserActionsContainer::GetPreferredSize() { |
| 526 if (browser_action_views_.empty()) | 526 if (browser_action_views_.empty()) |
| 527 return gfx::Size(ToolbarView::kStandardSpacing, 0); | 527 return gfx::Size(ToolbarView::kStandardSpacing, 0); |
| 528 | 528 |
| 529 // We calculate the size of the view by taking the current width and | 529 // 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 | 530 // subtracting resize_amount_ (the latter represents how far the user is |
| (...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1097 AnimationEnded(resize_animation_.get()); | 1097 AnimationEnded(resize_animation_.get()); |
| 1098 } | 1098 } |
| 1099 } | 1099 } |
| 1100 | 1100 |
| 1101 bool BrowserActionsContainer::ShouldDisplayBrowserAction( | 1101 bool BrowserActionsContainer::ShouldDisplayBrowserAction( |
| 1102 const Extension* extension) { | 1102 const Extension* extension) { |
| 1103 // Only display incognito-enabled extensions while in incognito mode. | 1103 // Only display incognito-enabled extensions while in incognito mode. |
| 1104 return (!profile_->IsOffTheRecord() || | 1104 return (!profile_->IsOffTheRecord() || |
| 1105 profile_->GetExtensionService()->IsIncognitoEnabled(extension)); | 1105 profile_->GetExtensionService()->IsIncognitoEnabled(extension)); |
| 1106 } | 1106 } |
| OLD | NEW |