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 <stdint.h> | 7 #include <stdint.h> |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 2540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2551 signin_metrics::AccessPoint access_point) { | 2551 signin_metrics::AccessPoint access_point) { |
2552 #if defined(FRAME_AVATAR_BUTTON) | 2552 #if defined(FRAME_AVATAR_BUTTON) |
2553 // Do not show avatar bubble if there is no avatar menu button. | 2553 // Do not show avatar bubble if there is no avatar menu button. |
2554 if (!frame_->GetNewAvatarMenuButton()) | 2554 if (!frame_->GetNewAvatarMenuButton()) |
2555 return; | 2555 return; |
2556 | 2556 |
2557 profiles::BubbleViewMode bubble_view_mode; | 2557 profiles::BubbleViewMode bubble_view_mode; |
2558 profiles::TutorialMode tutorial_mode; | 2558 profiles::TutorialMode tutorial_mode; |
2559 profiles::BubbleViewModeFromAvatarBubbleMode(mode, &bubble_view_mode, | 2559 profiles::BubbleViewModeFromAvatarBubbleMode(mode, &bubble_view_mode, |
2560 &tutorial_mode); | 2560 &tutorial_mode); |
2561 | |
2562 if (SigninViewController::ShouldShowModalSigninForMode(bubble_view_mode)) { | 2561 if (SigninViewController::ShouldShowModalSigninForMode(bubble_view_mode)) { |
2563 ShowModalSigninWindow(mode, access_point); | 2562 ShowModalSigninWindow(mode, access_point); |
2564 } else { | 2563 } else { |
2565 ProfileChooserView::ShowBubble( | 2564 ProfileChooserView::ShowBubble( |
2566 bubble_view_mode, tutorial_mode, manage_accounts_params, access_point, | 2565 bubble_view_mode, tutorial_mode, manage_accounts_params, access_point, |
2567 frame_->GetNewAvatarMenuButton(), views::BubbleBorder::TOP_RIGHT, | 2566 frame_->GetNewAvatarMenuButton(), views::BubbleBorder::TOP_RIGHT, |
2568 views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE, browser()); | 2567 views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE, browser()); |
2569 ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::ICON_AVATAR_BUBBLE); | 2568 ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::ICON_AVATAR_BUBBLE); |
2570 } | 2569 } |
2571 #else | 2570 #else |
2572 NOTREACHED(); | 2571 NOTREACHED(); |
2573 #endif | 2572 #endif |
2574 } | 2573 } |
2575 | 2574 |
| 2575 void BrowserView::CloseModalSigninWindow() { |
| 2576 signin_view_controller_.CloseModalSignin(); |
| 2577 } |
| 2578 |
2576 void BrowserView::ShowModalSigninWindow( | 2579 void BrowserView::ShowModalSigninWindow( |
2577 AvatarBubbleMode mode, | 2580 AvatarBubbleMode mode, |
2578 signin_metrics::AccessPoint access_point) { | 2581 signin_metrics::AccessPoint access_point) { |
2579 profiles::BubbleViewMode bubble_view_mode; | 2582 profiles::BubbleViewMode bubble_view_mode; |
2580 profiles::TutorialMode tutorial_mode; | 2583 profiles::TutorialMode tutorial_mode; |
2581 profiles::BubbleViewModeFromAvatarBubbleMode(mode, &bubble_view_mode, | 2584 profiles::BubbleViewModeFromAvatarBubbleMode(mode, &bubble_view_mode, |
2582 &tutorial_mode); | 2585 &tutorial_mode); |
2583 signin_view_controller_.ShowModalSignin(bubble_view_mode, browser(), | 2586 signin_view_controller_.ShowModalSignin(bubble_view_mode, browser(), |
2584 access_point); | 2587 access_point); |
2585 } | 2588 } |
2586 | 2589 |
2587 void BrowserView::CloseModalSigninWindow() { | 2590 void BrowserView::ShowModalSyncConfirmationWindow() { |
2588 signin_view_controller_.CloseModalSignin(); | 2591 signin_view_controller_.ShowModalSyncConfirmationDialog(browser()); |
2589 } | 2592 } |
2590 | 2593 |
2591 int BrowserView::GetRenderViewHeightInsetWithDetachedBookmarkBar() { | 2594 int BrowserView::GetRenderViewHeightInsetWithDetachedBookmarkBar() { |
2592 if (browser_->bookmark_bar_state() != BookmarkBar::DETACHED || | 2595 if (browser_->bookmark_bar_state() != BookmarkBar::DETACHED || |
2593 !bookmark_bar_view_ || !bookmark_bar_view_->IsDetached()) { | 2596 !bookmark_bar_view_ || !bookmark_bar_view_->IsDetached()) { |
2594 return 0; | 2597 return 0; |
2595 } | 2598 } |
2596 // Don't use bookmark_bar_view_->height() which won't be the final height if | 2599 // Don't use bookmark_bar_view_->height() which won't be the final height if |
2597 // the bookmark bar is animating. | 2600 // the bookmark bar is animating. |
2598 return chrome::kNTPBookmarkBarHeight - | 2601 return chrome::kNTPBookmarkBarHeight - |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2687 return immersive_mode_controller()->IsEnabled(); | 2690 return immersive_mode_controller()->IsEnabled(); |
2688 } | 2691 } |
2689 | 2692 |
2690 views::Widget* BrowserView::GetBubbleAssociatedWidget() { | 2693 views::Widget* BrowserView::GetBubbleAssociatedWidget() { |
2691 return GetWidget(); | 2694 return GetWidget(); |
2692 } | 2695 } |
2693 | 2696 |
2694 gfx::Rect BrowserView::GetTopContainerBoundsInScreen() { | 2697 gfx::Rect BrowserView::GetTopContainerBoundsInScreen() { |
2695 return top_container_->GetBoundsInScreen(); | 2698 return top_container_->GetBoundsInScreen(); |
2696 } | 2699 } |
OLD | NEW |