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