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