| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #include "chrome/browser/ui/views/frame/browser_view.h" | 5 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 2539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2550 #endif | 2550 #endif |
| 2551 } | 2551 } |
| 2552 | 2552 |
| 2553 void BrowserView::ShowAvatarBubbleFromAvatarButton( | 2553 void BrowserView::ShowAvatarBubbleFromAvatarButton( |
| 2554 AvatarBubbleMode mode, | 2554 AvatarBubbleMode mode, |
| 2555 const signin::ManageAccountsParams& manage_accounts_params) { | 2555 const signin::ManageAccountsParams& manage_accounts_params) { |
| 2556 #if defined(FRAME_AVATAR_BUTTON) | 2556 #if defined(FRAME_AVATAR_BUTTON) |
| 2557 // Do not show avatar bubble if there is no avatar menu button. | 2557 // Do not show avatar bubble if there is no avatar menu button. |
| 2558 if (!frame_->GetNewAvatarMenuButton()) | 2558 if (!frame_->GetNewAvatarMenuButton()) |
| 2559 return; | 2559 return; |
| 2560 |
| 2560 profiles::BubbleViewMode bubble_view_mode; | 2561 profiles::BubbleViewMode bubble_view_mode; |
| 2561 profiles::TutorialMode tutorial_mode; | 2562 profiles::TutorialMode tutorial_mode; |
| 2562 profiles::BubbleViewModeFromAvatarBubbleMode(mode, &bubble_view_mode, | 2563 profiles::BubbleViewModeFromAvatarBubbleMode(mode, &bubble_view_mode, |
| 2563 &tutorial_mode); | 2564 &tutorial_mode); |
| 2564 ProfileChooserView::ShowBubble( | 2565 |
| 2565 bubble_view_mode, tutorial_mode, manage_accounts_params, | 2566 if (SigninViewController::ShouldShowModalSigninForMode(bubble_view_mode)) { |
| 2566 frame_->GetNewAvatarMenuButton(), views::BubbleBorder::TOP_RIGHT, | 2567 ShowModalSigninWindow(mode); |
| 2567 views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE, browser()); | 2568 } else { |
| 2568 ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::ICON_AVATAR_BUBBLE); | 2569 ProfileChooserView::ShowBubble( |
| 2570 bubble_view_mode, tutorial_mode, manage_accounts_params, |
| 2571 frame_->GetNewAvatarMenuButton(), views::BubbleBorder::TOP_RIGHT, |
| 2572 views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE, browser()); |
| 2573 ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::ICON_AVATAR_BUBBLE); |
| 2574 } |
| 2569 #else | 2575 #else |
| 2570 NOTREACHED(); | 2576 NOTREACHED(); |
| 2571 #endif | 2577 #endif |
| 2572 } | 2578 } |
| 2573 | 2579 |
| 2580 void BrowserView::ShowModalSigninWindow(AvatarBubbleMode mode) { |
| 2581 profiles::BubbleViewMode bubble_view_mode; |
| 2582 profiles::TutorialMode tutorial_mode; |
| 2583 profiles::BubbleViewModeFromAvatarBubbleMode(mode, &bubble_view_mode, |
| 2584 &tutorial_mode); |
| 2585 signin_view_controller_.ShowModalSignin(bubble_view_mode, browser()); |
| 2586 } |
| 2587 |
| 2588 void BrowserView::CloseModalSigninWindow() { |
| 2589 signin_view_controller_.CloseModalSignin(); |
| 2590 } |
| 2591 |
| 2574 int BrowserView::GetRenderViewHeightInsetWithDetachedBookmarkBar() { | 2592 int BrowserView::GetRenderViewHeightInsetWithDetachedBookmarkBar() { |
| 2575 if (browser_->bookmark_bar_state() != BookmarkBar::DETACHED || | 2593 if (browser_->bookmark_bar_state() != BookmarkBar::DETACHED || |
| 2576 !bookmark_bar_view_ || !bookmark_bar_view_->IsDetached()) { | 2594 !bookmark_bar_view_ || !bookmark_bar_view_->IsDetached()) { |
| 2577 return 0; | 2595 return 0; |
| 2578 } | 2596 } |
| 2579 // Don't use bookmark_bar_view_->height() which won't be the final height if | 2597 // Don't use bookmark_bar_view_->height() which won't be the final height if |
| 2580 // the bookmark bar is animating. | 2598 // the bookmark bar is animating. |
| 2581 return chrome::kNTPBookmarkBarHeight - | 2599 return chrome::kNTPBookmarkBarHeight - |
| 2582 views::NonClientFrameView::kClientEdgeThickness; | 2600 views::NonClientFrameView::kClientEdgeThickness; |
| 2583 } | 2601 } |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2670 return immersive_mode_controller()->IsEnabled(); | 2688 return immersive_mode_controller()->IsEnabled(); |
| 2671 } | 2689 } |
| 2672 | 2690 |
| 2673 views::Widget* BrowserView::GetBubbleAssociatedWidget() { | 2691 views::Widget* BrowserView::GetBubbleAssociatedWidget() { |
| 2674 return GetWidget(); | 2692 return GetWidget(); |
| 2675 } | 2693 } |
| 2676 | 2694 |
| 2677 gfx::Rect BrowserView::GetTopContainerBoundsInScreen() { | 2695 gfx::Rect BrowserView::GetTopContainerBoundsInScreen() { |
| 2678 return top_container_->GetBoundsInScreen(); | 2696 return top_container_->GetBoundsInScreen(); |
| 2679 } | 2697 } |
| OLD | NEW |