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 2322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2367 const gfx::Rect& rect) { | 2368 const gfx::Rect& rect) { |
2368 gfx::Point origin(rect.origin()); | 2369 gfx::Point origin(rect.origin()); |
2369 views::View::ConvertPointToScreen(GetTabContentsContainerView(), &origin); | 2370 views::View::ConvertPointToScreen(GetTabContentsContainerView(), &origin); |
2370 gfx::Rect bounds(origin, rect.size()); | 2371 gfx::Rect bounds(origin, rect.size()); |
2371 | 2372 |
2372 AvatarMenuBubbleView::ShowBubble( | 2373 AvatarMenuBubbleView::ShowBubble( |
2373 this, views::BubbleBorder::TOP_RIGHT, views::BubbleBorder::PAINT_NORMAL, | 2374 this, views::BubbleBorder::TOP_RIGHT, views::BubbleBorder::PAINT_NORMAL, |
2374 views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE, bounds, browser_.get()); | 2375 views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE, bounds, browser_.get()); |
2375 } | 2376 } |
2376 | 2377 |
2377 void BrowserView::ShowAvatarBubbleFromAvatarButton(AvatarBubbleMode mode) { | 2378 void BrowserView::ShowAvatarBubbleFromAvatarButton(AvatarBubbleMode mode, |
| 2379 signin::GAIA_SERVICE_TYPE service_type) { |
2378 if (switches::IsNewAvatarMenu()) { | 2380 if (switches::IsNewAvatarMenu()) { |
2379 NewAvatarButton* button = frame_->GetNewAvatarMenuButton(); | 2381 NewAvatarButton* button = frame_->GetNewAvatarMenuButton(); |
2380 if (button) { | 2382 if (button) { |
2381 gfx::Point origin; | 2383 gfx::Point origin; |
2382 views::View::ConvertPointToScreen(button, &origin); | 2384 views::View::ConvertPointToScreen(button, &origin); |
2383 gfx::Rect bounds(origin, size()); | 2385 gfx::Rect bounds(origin, size()); |
2384 | 2386 |
2385 ProfileChooserView::BubbleViewMode view_mode = | 2387 ProfileChooserView::BubbleViewMode view_mode = |
2386 (mode == BrowserWindow::AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT) ? | 2388 (mode == BrowserWindow::AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT) ? |
2387 ProfileChooserView::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT : | 2389 ProfileChooserView::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT : |
2388 ProfileChooserView::BUBBLE_VIEW_MODE_PROFILE_CHOOSER; | 2390 ProfileChooserView::BUBBLE_VIEW_MODE_PROFILE_CHOOSER; |
2389 ProfileChooserView::ShowBubble( | 2391 ProfileChooserView::ShowBubble( |
2390 view_mode, button, views::BubbleBorder::TOP_RIGHT, | 2392 view_mode, service_type, button, views::BubbleBorder::TOP_RIGHT, |
2391 views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE, bounds, browser()); | 2393 views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE, bounds, browser()); |
2392 } | 2394 } |
2393 } else { | 2395 } else { |
2394 views::BubbleBorder::Arrow arrow = views::BubbleBorder::TOP_RIGHT; | 2396 views::BubbleBorder::Arrow arrow = views::BubbleBorder::TOP_RIGHT; |
2395 views::View* anchor_view = frame_->GetAvatarMenuButton(); | 2397 views::View* anchor_view = frame_->GetAvatarMenuButton(); |
2396 if (!anchor_view) | 2398 if (!anchor_view) |
2397 anchor_view = toolbar_->app_menu(); | 2399 anchor_view = toolbar_->app_menu(); |
2398 else if (!frame_->GetAvatarMenuButton()->button_on_right()) | 2400 else if (!frame_->GetAvatarMenuButton()->button_on_right()) |
2399 arrow = views::BubbleBorder::TOP_LEFT; | 2401 arrow = views::BubbleBorder::TOP_LEFT; |
2400 gfx::Point origin; | 2402 gfx::Point origin; |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2533 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { | 2535 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { |
2534 gfx::Point icon_bottom( | 2536 gfx::Point icon_bottom( |
2535 toolbar_->location_bar()->GetLocationBarAnchorPoint()); | 2537 toolbar_->location_bar()->GetLocationBarAnchorPoint()); |
2536 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); | 2538 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); |
2537 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); | 2539 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); |
2538 ConvertPointToTarget(infobar_container_, this, &infobar_top); | 2540 ConvertPointToTarget(infobar_container_, this, &infobar_top); |
2539 top_arrow_height = infobar_top.y() - icon_bottom.y(); | 2541 top_arrow_height = infobar_top.y() - icon_bottom.y(); |
2540 } | 2542 } |
2541 return top_arrow_height; | 2543 return top_arrow_height; |
2542 } | 2544 } |
OLD | NEW |