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