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 2534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2545 break; | 2545 break; |
2546 default: | 2546 default: |
2547 // Do nothing. | 2547 // Do nothing. |
2548 break; | 2548 break; |
2549 } | 2549 } |
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 signin_metrics::AccessPoint access_point) { |
2556 #if defined(FRAME_AVATAR_BUTTON) | 2557 #if defined(FRAME_AVATAR_BUTTON) |
2557 // Do not show avatar bubble if there is no avatar menu button. | 2558 // Do not show avatar bubble if there is no avatar menu button. |
2558 if (!frame_->GetNewAvatarMenuButton()) | 2559 if (!frame_->GetNewAvatarMenuButton()) |
2559 return; | 2560 return; |
2560 | 2561 |
2561 profiles::BubbleViewMode bubble_view_mode; | 2562 profiles::BubbleViewMode bubble_view_mode; |
2562 profiles::TutorialMode tutorial_mode; | 2563 profiles::TutorialMode tutorial_mode; |
2563 profiles::BubbleViewModeFromAvatarBubbleMode(mode, &bubble_view_mode, | 2564 profiles::BubbleViewModeFromAvatarBubbleMode(mode, &bubble_view_mode, |
2564 &tutorial_mode); | 2565 &tutorial_mode); |
2565 | 2566 |
2566 if (SigninViewController::ShouldShowModalSigninForMode(bubble_view_mode)) { | 2567 if (SigninViewController::ShouldShowModalSigninForMode(bubble_view_mode)) { |
2567 ShowModalSigninWindow(mode); | 2568 ShowModalSigninWindow(mode, access_point); |
2568 } else { | 2569 } else { |
2569 ProfileChooserView::ShowBubble( | 2570 ProfileChooserView::ShowBubble( |
2570 bubble_view_mode, tutorial_mode, manage_accounts_params, | 2571 bubble_view_mode, tutorial_mode, manage_accounts_params, access_point, |
2571 frame_->GetNewAvatarMenuButton(), views::BubbleBorder::TOP_RIGHT, | 2572 frame_->GetNewAvatarMenuButton(), views::BubbleBorder::TOP_RIGHT, |
2572 views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE, browser()); | 2573 views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE, browser()); |
2573 ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::ICON_AVATAR_BUBBLE); | 2574 ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::ICON_AVATAR_BUBBLE); |
2574 } | 2575 } |
2575 #else | 2576 #else |
2576 NOTREACHED(); | 2577 NOTREACHED(); |
2577 #endif | 2578 #endif |
2578 } | 2579 } |
2579 | 2580 |
2580 void BrowserView::ShowModalSigninWindow(AvatarBubbleMode mode) { | 2581 void BrowserView::ShowModalSigninWindow( |
| 2582 AvatarBubbleMode mode, |
| 2583 signin_metrics::AccessPoint access_point) { |
2581 profiles::BubbleViewMode bubble_view_mode; | 2584 profiles::BubbleViewMode bubble_view_mode; |
2582 profiles::TutorialMode tutorial_mode; | 2585 profiles::TutorialMode tutorial_mode; |
2583 profiles::BubbleViewModeFromAvatarBubbleMode(mode, &bubble_view_mode, | 2586 profiles::BubbleViewModeFromAvatarBubbleMode(mode, &bubble_view_mode, |
2584 &tutorial_mode); | 2587 &tutorial_mode); |
2585 signin_view_controller_.ShowModalSignin(bubble_view_mode, browser()); | 2588 signin_view_controller_.ShowModalSignin(bubble_view_mode, browser(), |
| 2589 access_point); |
2586 } | 2590 } |
2587 | 2591 |
2588 void BrowserView::CloseModalSigninWindow() { | 2592 void BrowserView::CloseModalSigninWindow() { |
2589 signin_view_controller_.CloseModalSignin(); | 2593 signin_view_controller_.CloseModalSignin(); |
2590 } | 2594 } |
2591 | 2595 |
2592 int BrowserView::GetRenderViewHeightInsetWithDetachedBookmarkBar() { | 2596 int BrowserView::GetRenderViewHeightInsetWithDetachedBookmarkBar() { |
2593 if (browser_->bookmark_bar_state() != BookmarkBar::DETACHED || | 2597 if (browser_->bookmark_bar_state() != BookmarkBar::DETACHED || |
2594 !bookmark_bar_view_ || !bookmark_bar_view_->IsDetached()) { | 2598 !bookmark_bar_view_ || !bookmark_bar_view_->IsDetached()) { |
2595 return 0; | 2599 return 0; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2688 return immersive_mode_controller()->IsEnabled(); | 2692 return immersive_mode_controller()->IsEnabled(); |
2689 } | 2693 } |
2690 | 2694 |
2691 views::Widget* BrowserView::GetBubbleAssociatedWidget() { | 2695 views::Widget* BrowserView::GetBubbleAssociatedWidget() { |
2692 return GetWidget(); | 2696 return GetWidget(); |
2693 } | 2697 } |
2694 | 2698 |
2695 gfx::Rect BrowserView::GetTopContainerBoundsInScreen() { | 2699 gfx::Rect BrowserView::GetTopContainerBoundsInScreen() { |
2696 return top_container_->GetBoundsInScreen(); | 2700 return top_container_->GetBoundsInScreen(); |
2697 } | 2701 } |
OLD | NEW |