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 2360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2371 views::View::ConvertPointToScreen(GetTabContentsContainerView(), &origin); | 2371 views::View::ConvertPointToScreen(GetTabContentsContainerView(), &origin); |
2372 gfx::Rect bounds(origin, rect.size()); | 2372 gfx::Rect bounds(origin, rect.size()); |
2373 | 2373 |
2374 AvatarMenuBubbleView::ShowBubble( | 2374 AvatarMenuBubbleView::ShowBubble( |
2375 this, views::BubbleBorder::TOP_RIGHT, views::BubbleBorder::PAINT_NORMAL, | 2375 this, views::BubbleBorder::TOP_RIGHT, views::BubbleBorder::PAINT_NORMAL, |
2376 views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE, bounds, browser_.get()); | 2376 views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE, bounds, browser_.get()); |
2377 } | 2377 } |
2378 | 2378 |
2379 void BrowserView::ShowAvatarBubbleFromAvatarButton( | 2379 void BrowserView::ShowAvatarBubbleFromAvatarButton( |
2380 AvatarBubbleMode mode, | 2380 AvatarBubbleMode mode, |
2381 signin::GAIAServiceType service_type) { | 2381 const signin::ManageAccountsParams& manage_accounts_params) { |
2382 views::BubbleBorder::Arrow arrow = views::BubbleBorder::TOP_RIGHT; | 2382 views::BubbleBorder::Arrow arrow = views::BubbleBorder::TOP_RIGHT; |
2383 views::BubbleBorder::BubbleAlignment alignment = | 2383 views::BubbleBorder::BubbleAlignment alignment = |
2384 views::BubbleBorder::ALIGN_ARROW_TO_MID_ANCHOR; | 2384 views::BubbleBorder::ALIGN_ARROW_TO_MID_ANCHOR; |
2385 views::View* anchor_view = frame_->GetAvatarMenuButton(); | 2385 views::View* anchor_view = frame_->GetAvatarMenuButton(); |
2386 if (!anchor_view) | 2386 if (!anchor_view) |
2387 anchor_view = toolbar_->app_menu(); | 2387 anchor_view = toolbar_->app_menu(); |
2388 else if (!frame_->GetAvatarMenuButton()->button_on_right()) | 2388 else if (!frame_->GetAvatarMenuButton()->button_on_right()) |
2389 arrow = views::BubbleBorder::TOP_LEFT; | 2389 arrow = views::BubbleBorder::TOP_LEFT; |
2390 | 2390 |
2391 if (switches::IsNewAvatarMenu()) { | 2391 if (switches::IsNewAvatarMenu()) { |
2392 NewAvatarButton* button = frame_->GetNewAvatarMenuButton(); | 2392 NewAvatarButton* button = frame_->GetNewAvatarMenuButton(); |
2393 if (button) { | 2393 if (button) { |
2394 anchor_view = button; | 2394 anchor_view = button; |
2395 arrow = views::BubbleBorder::TOP_RIGHT; | 2395 arrow = views::BubbleBorder::TOP_RIGHT; |
2396 alignment = views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE; | 2396 alignment = views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE; |
2397 } | 2397 } |
2398 | 2398 |
2399 profiles::BubbleViewMode view_mode; | 2399 profiles::BubbleViewMode view_mode; |
2400 switch (mode) { | 2400 switch (mode) { |
2401 case AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT: | 2401 case AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT: |
2402 view_mode = profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT; | 2402 view_mode = profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT; |
2403 break; | 2403 break; |
2404 case AVATAR_BUBBLE_MODE_SIGNIN: | 2404 case AVATAR_BUBBLE_MODE_SIGNIN: |
2405 view_mode = profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN; | 2405 view_mode = profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN; |
2406 break; | 2406 break; |
2407 case AVATAR_BUBBLE_MODE_REAUTH: | 2407 case AVATAR_BUBBLE_MODE_REAUTH: |
2408 view_mode = profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH; | 2408 view_mode = profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH; |
2409 break; | 2409 break; |
2410 default: | 2410 default: |
2411 view_mode = profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER; | 2411 view_mode = profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER; |
2412 break; | 2412 break; |
2413 } | 2413 } |
2414 ProfileChooserView::ShowBubble(view_mode, service_type, anchor_view, arrow, | 2414 ProfileChooserView::ShowBubble(view_mode, manage_accounts_params, |
2415 alignment, browser()); | 2415 anchor_view, arrow, alignment, browser()); |
2416 } else { | 2416 } else { |
2417 gfx::Point origin; | 2417 gfx::Point origin; |
2418 views::View::ConvertPointToScreen(anchor_view, &origin); | 2418 views::View::ConvertPointToScreen(anchor_view, &origin); |
2419 gfx::Rect bounds(origin, anchor_view->size()); | 2419 gfx::Rect bounds(origin, anchor_view->size()); |
2420 views::BubbleBorder::ArrowPaintType arrow_paint_type = | 2420 views::BubbleBorder::ArrowPaintType arrow_paint_type = |
2421 ShouldHideUIForFullscreen() ? views::BubbleBorder::PAINT_TRANSPARENT : | 2421 ShouldHideUIForFullscreen() ? views::BubbleBorder::PAINT_TRANSPARENT : |
2422 views::BubbleBorder::PAINT_NORMAL; | 2422 views::BubbleBorder::PAINT_NORMAL; |
2423 AvatarMenuBubbleView::ShowBubble(anchor_view, arrow, arrow_paint_type, | 2423 AvatarMenuBubbleView::ShowBubble(anchor_view, arrow, arrow_paint_type, |
2424 alignment, bounds, browser()); | 2424 alignment, bounds, browser()); |
2425 ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::ICON_AVATAR_BUBBLE); | 2425 ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::ICON_AVATAR_BUBBLE); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2547 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { | 2547 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { |
2548 gfx::Point icon_bottom( | 2548 gfx::Point icon_bottom( |
2549 toolbar_->location_bar()->GetLocationBarAnchorPoint()); | 2549 toolbar_->location_bar()->GetLocationBarAnchorPoint()); |
2550 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); | 2550 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); |
2551 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); | 2551 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); |
2552 ConvertPointToTarget(infobar_container_, this, &infobar_top); | 2552 ConvertPointToTarget(infobar_container_, this, &infobar_top); |
2553 top_arrow_height = infobar_top.y() - icon_bottom.y(); | 2553 top_arrow_height = infobar_top.y() - icon_bottom.y(); |
2554 } | 2554 } |
2555 return top_arrow_height; | 2555 return top_arrow_height; |
2556 } | 2556 } |
OLD | NEW |