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 14 matching lines...) Expand all Loading... |
25 #include "chrome/browser/password_manager/chrome_password_manager_client.h" | 25 #include "chrome/browser/password_manager/chrome_password_manager_client.h" |
26 #include "chrome/browser/profiles/avatar_menu.h" | 26 #include "chrome/browser/profiles/avatar_menu.h" |
27 #include "chrome/browser/profiles/profile.h" | 27 #include "chrome/browser/profiles/profile.h" |
28 #include "chrome/browser/profiles/profile_avatar_icon_util.h" | 28 #include "chrome/browser/profiles/profile_avatar_icon_util.h" |
29 #include "chrome/browser/profiles/profile_info_cache.h" | 29 #include "chrome/browser/profiles/profile_info_cache.h" |
30 #include "chrome/browser/profiles/profile_manager.h" | 30 #include "chrome/browser/profiles/profile_manager.h" |
31 #include "chrome/browser/profiles/profiles_state.h" | 31 #include "chrome/browser/profiles/profiles_state.h" |
32 #include "chrome/browser/search/search.h" | 32 #include "chrome/browser/search/search.h" |
33 #include "chrome/browser/sessions/tab_restore_service.h" | 33 #include "chrome/browser/sessions/tab_restore_service.h" |
34 #include "chrome/browser/sessions/tab_restore_service_factory.h" | 34 #include "chrome/browser/sessions/tab_restore_service_factory.h" |
| 35 #include "chrome/browser/signin/signin_header_helper.h" |
35 #include "chrome/browser/speech/tts_controller.h" | 36 #include "chrome/browser/speech/tts_controller.h" |
36 #include "chrome/browser/themes/theme_properties.h" | 37 #include "chrome/browser/themes/theme_properties.h" |
37 #include "chrome/browser/themes/theme_service_factory.h" | 38 #include "chrome/browser/themes/theme_service_factory.h" |
38 #include "chrome/browser/translate/translate_tab_helper.h" | 39 #include "chrome/browser/translate/translate_tab_helper.h" |
39 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h" | 40 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h" |
40 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog_queue.h" | 41 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog_queue.h" |
41 #include "chrome/browser/ui/bookmarks/bookmark_bar_constants.h" | 42 #include "chrome/browser/ui/bookmarks/bookmark_bar_constants.h" |
42 #include "chrome/browser/ui/bookmarks/bookmark_bubble_delegate.h" | 43 #include "chrome/browser/ui/bookmarks/bookmark_bubble_delegate.h" |
43 #include "chrome/browser/ui/bookmarks/bookmark_bubble_sign_in_delegate.h" | 44 #include "chrome/browser/ui/bookmarks/bookmark_bubble_sign_in_delegate.h" |
44 #include "chrome/browser/ui/browser.h" | 45 #include "chrome/browser/ui/browser.h" |
(...skipping 2330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2375 const gfx::Rect& rect) { | 2376 const gfx::Rect& rect) { |
2376 gfx::Point origin(rect.origin()); | 2377 gfx::Point origin(rect.origin()); |
2377 views::View::ConvertPointToScreen(GetTabContentsContainerView(), &origin); | 2378 views::View::ConvertPointToScreen(GetTabContentsContainerView(), &origin); |
2378 gfx::Rect bounds(origin, rect.size()); | 2379 gfx::Rect bounds(origin, rect.size()); |
2379 | 2380 |
2380 AvatarMenuBubbleView::ShowBubble( | 2381 AvatarMenuBubbleView::ShowBubble( |
2381 this, views::BubbleBorder::TOP_RIGHT, views::BubbleBorder::PAINT_NORMAL, | 2382 this, views::BubbleBorder::TOP_RIGHT, views::BubbleBorder::PAINT_NORMAL, |
2382 views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE, bounds, browser_.get()); | 2383 views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE, bounds, browser_.get()); |
2383 } | 2384 } |
2384 | 2385 |
2385 void BrowserView::ShowAvatarBubbleFromAvatarButton(AvatarBubbleMode mode) { | 2386 void BrowserView::ShowAvatarBubbleFromAvatarButton( |
| 2387 AvatarBubbleMode mode, |
| 2388 signin::GAIAServiceType service_type) { |
2386 if (switches::IsNewAvatarMenu()) { | 2389 if (switches::IsNewAvatarMenu()) { |
2387 NewAvatarButton* button = frame_->GetNewAvatarMenuButton(); | 2390 NewAvatarButton* button = frame_->GetNewAvatarMenuButton(); |
2388 if (button) { | 2391 if (button) { |
2389 gfx::Point origin; | 2392 gfx::Point origin; |
2390 views::View::ConvertPointToScreen(button, &origin); | 2393 views::View::ConvertPointToScreen(button, &origin); |
2391 gfx::Rect bounds(origin, size()); | 2394 gfx::Rect bounds(origin, size()); |
2392 | 2395 |
2393 profiles::BubbleViewMode view_mode; | 2396 profiles::BubbleViewMode view_mode; |
2394 switch (mode) { | 2397 switch (mode) { |
2395 case AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT: | 2398 case AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT: |
2396 view_mode = profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT; | 2399 view_mode = profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT; |
2397 break; | 2400 break; |
2398 case AVATAR_BUBBLE_MODE_SIGNIN: | 2401 case AVATAR_BUBBLE_MODE_SIGNIN: |
2399 view_mode = profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN; | 2402 view_mode = profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN; |
2400 break; | 2403 break; |
2401 case AVATAR_BUBBLE_MODE_REAUTH: | 2404 case AVATAR_BUBBLE_MODE_REAUTH: |
2402 view_mode = profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH; | 2405 view_mode = profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH; |
2403 break; | 2406 break; |
2404 default: | 2407 default: |
2405 view_mode = profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER; | 2408 view_mode = profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER; |
2406 break; | 2409 break; |
2407 } | 2410 } |
2408 | |
2409 ProfileChooserView::ShowBubble( | 2411 ProfileChooserView::ShowBubble( |
2410 view_mode, button, views::BubbleBorder::TOP_RIGHT, | 2412 view_mode, service_type, button, views::BubbleBorder::TOP_RIGHT, |
2411 views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE, bounds, browser()); | 2413 views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE, bounds, browser()); |
2412 } | 2414 } |
2413 } else { | 2415 } else { |
2414 views::BubbleBorder::Arrow arrow = views::BubbleBorder::TOP_RIGHT; | 2416 views::BubbleBorder::Arrow arrow = views::BubbleBorder::TOP_RIGHT; |
2415 views::View* anchor_view = frame_->GetAvatarMenuButton(); | 2417 views::View* anchor_view = frame_->GetAvatarMenuButton(); |
2416 if (!anchor_view) | 2418 if (!anchor_view) |
2417 anchor_view = toolbar_->app_menu(); | 2419 anchor_view = toolbar_->app_menu(); |
2418 else if (!frame_->GetAvatarMenuButton()->button_on_right()) | 2420 else if (!frame_->GetAvatarMenuButton()->button_on_right()) |
2419 arrow = views::BubbleBorder::TOP_LEFT; | 2421 arrow = views::BubbleBorder::TOP_LEFT; |
2420 gfx::Point origin; | 2422 gfx::Point origin; |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2553 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { | 2555 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { |
2554 gfx::Point icon_bottom( | 2556 gfx::Point icon_bottom( |
2555 toolbar_->location_bar()->GetLocationBarAnchorPoint()); | 2557 toolbar_->location_bar()->GetLocationBarAnchorPoint()); |
2556 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); | 2558 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); |
2557 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); | 2559 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); |
2558 ConvertPointToTarget(infobar_container_, this, &infobar_top); | 2560 ConvertPointToTarget(infobar_container_, this, &infobar_top); |
2559 top_arrow_height = infobar_top.y() - icon_bottom.y(); | 2561 top_arrow_height = infobar_top.y() - icon_bottom.y(); |
2560 } | 2562 } |
2561 return top_arrow_height; | 2563 return top_arrow_height; |
2562 } | 2564 } |
OLD | NEW |