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 2364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2375 } | 2375 } |
2376 | 2376 |
2377 void BrowserView::ShowAvatarBubbleFromAvatarButton(AvatarBubbleMode mode) { | 2377 void BrowserView::ShowAvatarBubbleFromAvatarButton(AvatarBubbleMode mode) { |
2378 if (switches::IsNewAvatarMenu()) { | 2378 if (switches::IsNewAvatarMenu()) { |
2379 NewAvatarButton* button = frame_->GetNewAvatarMenuButton(); | 2379 NewAvatarButton* button = frame_->GetNewAvatarMenuButton(); |
2380 if (button) { | 2380 if (button) { |
2381 gfx::Point origin; | 2381 gfx::Point origin; |
2382 views::View::ConvertPointToScreen(button, &origin); | 2382 views::View::ConvertPointToScreen(button, &origin); |
2383 gfx::Rect bounds(origin, size()); | 2383 gfx::Rect bounds(origin, size()); |
2384 | 2384 |
2385 ProfileChooserView::BubbleViewMode view_mode = | 2385 ProfileChooserView::BubbleViewMode view_mode; |
2386 (mode == BrowserWindow::AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT) ? | 2386 switch (mode) { |
2387 ProfileChooserView::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT : | 2387 case BrowserWindow::AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT: |
2388 ProfileChooserView::BUBBLE_VIEW_MODE_PROFILE_CHOOSER; | 2388 view_mode = ProfileChooserView::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT; |
| 2389 break; |
| 2390 case BrowserWindow::AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT_FROM_GAIA: |
| 2391 view_mode = |
| 2392 ProfileChooserView::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT_FROM_GAIA; |
| 2393 break; |
| 2394 case BrowserWindow::AVATAR_BUBBLE_MODE_DEFAULT: |
| 2395 view_mode = ProfileChooserView::BUBBLE_VIEW_MODE_PROFILE_CHOOSER; |
| 2396 } |
2389 ProfileChooserView::ShowBubble( | 2397 ProfileChooserView::ShowBubble( |
2390 view_mode, button, views::BubbleBorder::TOP_RIGHT, | 2398 view_mode, button, views::BubbleBorder::TOP_RIGHT, |
2391 views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE, bounds, browser()); | 2399 views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE, bounds, browser()); |
2392 } | 2400 } |
2393 } else { | 2401 } else { |
2394 views::BubbleBorder::Arrow arrow = views::BubbleBorder::TOP_RIGHT; | 2402 views::BubbleBorder::Arrow arrow = views::BubbleBorder::TOP_RIGHT; |
2395 views::View* anchor_view = frame_->GetAvatarMenuButton(); | 2403 views::View* anchor_view = frame_->GetAvatarMenuButton(); |
2396 if (!anchor_view) | 2404 if (!anchor_view) |
2397 anchor_view = toolbar_->app_menu(); | 2405 anchor_view = toolbar_->app_menu(); |
2398 else if (!frame_->GetAvatarMenuButton()->button_on_right()) | 2406 else if (!frame_->GetAvatarMenuButton()->button_on_right()) |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2533 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { | 2541 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { |
2534 gfx::Point icon_bottom( | 2542 gfx::Point icon_bottom( |
2535 toolbar_->location_bar()->GetLocationBarAnchorPoint()); | 2543 toolbar_->location_bar()->GetLocationBarAnchorPoint()); |
2536 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); | 2544 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); |
2537 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); | 2545 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); |
2538 ConvertPointToTarget(infobar_container_, this, &infobar_top); | 2546 ConvertPointToTarget(infobar_container_, this, &infobar_top); |
2539 top_arrow_height = infobar_top.y() - icon_bottom.y(); | 2547 top_arrow_height = infobar_top.y() - icon_bottom.y(); |
2540 } | 2548 } |
2541 return top_arrow_height; | 2549 return top_arrow_height; |
2542 } | 2550 } |
OLD | NEW |