Chromium Code Reviews| 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 2510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2521 #endif | 2521 #endif |
| 2522 } | 2522 } |
| 2523 | 2523 |
| 2524 void BrowserView::ShowAvatarBubbleFromAvatarButton( | 2524 void BrowserView::ShowAvatarBubbleFromAvatarButton( |
| 2525 AvatarBubbleMode mode, | 2525 AvatarBubbleMode mode, |
| 2526 const signin::ManageAccountsParams& manage_accounts_params) { | 2526 const signin::ManageAccountsParams& manage_accounts_params) { |
| 2527 #if defined(FRAME_AVATAR_BUTTON) | 2527 #if defined(FRAME_AVATAR_BUTTON) |
| 2528 // Do not show avatar bubble if there is no avatar menu button. | 2528 // Do not show avatar bubble if there is no avatar menu button. |
| 2529 if (!frame_->GetNewAvatarMenuButton()) | 2529 if (!frame_->GetNewAvatarMenuButton()) |
| 2530 return; | 2530 return; |
| 2531 profiles::BubbleViewMode bubble_view_mode; | 2531 |
| 2532 profiles::TutorialMode tutorial_mode; | 2532 if (switches::UsePasswordSeparatedSigninFlow() && |
| 2533 profiles::BubbleViewModeFromAvatarBubbleMode(mode, &bubble_view_mode, | 2533 (mode == AVATAR_BUBBLE_MODE_SIGNIN || |
| 2534 &tutorial_mode); | 2534 mode == AVATAR_BUBBLE_MODE_ADD_ACCOUNT || |
| 2535 ProfileChooserView::ShowBubble( | 2535 mode == AVATAR_BUBBLE_MODE_REAUTH)) { |
|
Roger Tawa OOO till Jul 10th
2015/11/11 19:34:30
Call SigninViewController::ShouldShowModalSigninFo
anthonyvd
2015/11/24 16:28:04
Missed that, thanks!
| |
| 2536 bubble_view_mode, tutorial_mode, manage_accounts_params, | 2536 ShowModalSigninWindow(mode); |
| 2537 frame_->GetNewAvatarMenuButton(), views::BubbleBorder::TOP_RIGHT, | 2537 } else { |
| 2538 views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE, browser()); | 2538 profiles::BubbleViewMode bubble_view_mode; |
| 2539 ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::ICON_AVATAR_BUBBLE); | 2539 profiles::TutorialMode tutorial_mode; |
| 2540 profiles::BubbleViewModeFromAvatarBubbleMode(mode, &bubble_view_mode, | |
| 2541 &tutorial_mode); | |
| 2542 ProfileChooserView::ShowBubble( | |
| 2543 bubble_view_mode, tutorial_mode, manage_accounts_params, | |
| 2544 frame_->GetNewAvatarMenuButton(), views::BubbleBorder::TOP_RIGHT, | |
| 2545 views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE, browser()); | |
| 2546 ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::ICON_AVATAR_BUBBLE); | |
| 2547 } | |
| 2540 #else | 2548 #else |
| 2541 NOTREACHED(); | 2549 NOTREACHED(); |
| 2542 #endif | 2550 #endif |
| 2543 } | 2551 } |
| 2544 | 2552 |
| 2553 void BrowserView::ShowModalSigninWindow(AvatarBubbleMode mode) { | |
| 2554 profiles::BubbleViewMode bubble_view_mode; | |
| 2555 profiles::TutorialMode tutorial_mode; | |
| 2556 profiles::BubbleViewModeFromAvatarBubbleMode(mode, &bubble_view_mode, | |
| 2557 &tutorial_mode); | |
| 2558 signin_view_controller_.ShowModalSignin(bubble_view_mode, browser()); | |
| 2559 } | |
| 2560 | |
| 2561 void BrowserView::CloseModalSigninWindow() { | |
| 2562 signin_view_controller_.CloseModalSignin(); | |
| 2563 } | |
| 2564 | |
| 2545 int BrowserView::GetRenderViewHeightInsetWithDetachedBookmarkBar() { | 2565 int BrowserView::GetRenderViewHeightInsetWithDetachedBookmarkBar() { |
| 2546 if (browser_->bookmark_bar_state() != BookmarkBar::DETACHED || | 2566 if (browser_->bookmark_bar_state() != BookmarkBar::DETACHED || |
| 2547 !bookmark_bar_view_ || !bookmark_bar_view_->IsDetached()) { | 2567 !bookmark_bar_view_ || !bookmark_bar_view_->IsDetached()) { |
| 2548 return 0; | 2568 return 0; |
| 2549 } | 2569 } |
| 2550 // Don't use bookmark_bar_view_->height() which won't be the final height if | 2570 // Don't use bookmark_bar_view_->height() which won't be the final height if |
| 2551 // the bookmark bar is animating. | 2571 // the bookmark bar is animating. |
| 2552 return chrome::kNTPBookmarkBarHeight - | 2572 return chrome::kNTPBookmarkBarHeight - |
| 2553 views::NonClientFrameView::kClientEdgeThickness; | 2573 views::NonClientFrameView::kClientEdgeThickness; |
| 2554 } | 2574 } |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2641 return immersive_mode_controller()->IsEnabled(); | 2661 return immersive_mode_controller()->IsEnabled(); |
| 2642 } | 2662 } |
| 2643 | 2663 |
| 2644 views::Widget* BrowserView::GetBubbleAssociatedWidget() { | 2664 views::Widget* BrowserView::GetBubbleAssociatedWidget() { |
| 2645 return GetWidget(); | 2665 return GetWidget(); |
| 2646 } | 2666 } |
| 2647 | 2667 |
| 2648 gfx::Rect BrowserView::GetTopContainerBoundsInScreen() { | 2668 gfx::Rect BrowserView::GetTopContainerBoundsInScreen() { |
| 2649 return top_container_->GetBoundsInScreen(); | 2669 return top_container_->GetBoundsInScreen(); |
| 2650 } | 2670 } |
| OLD | NEW |