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