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(AvatarBubbleMode mode, |
sky
2014/05/23 20:41:42
nit: wrap mode to the next line so the two paramet
Mike Lerman
2014/05/26 12:55:24
Done.
| |
2388 signin::GAIAServiceType service_type) { | |
2387 if (switches::IsNewAvatarMenu()) { | 2389 if (switches::IsNewAvatarMenu()) { |
2388 NewAvatarButton* button = frame_->GetNewAvatarMenuButton(); | 2390 NewAvatarButton* button = frame_->GetNewAvatarMenuButton(); |
2389 if (button) { | 2391 if (button) { |
2390 gfx::Point origin; | 2392 gfx::Point origin; |
2391 views::View::ConvertPointToScreen(button, &origin); | 2393 views::View::ConvertPointToScreen(button, &origin); |
2392 gfx::Rect bounds(origin, size()); | 2394 gfx::Rect bounds(origin, size()); |
2393 | 2395 |
2394 ProfileChooserView::BubbleViewMode view_mode; | 2396 ProfileChooserView::BubbleViewMode view_mode; |
2395 switch (mode) { | 2397 switch (mode) { |
2396 case AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT: | 2398 case AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT: |
2397 view_mode = ProfileChooserView::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT; | 2399 view_mode = ProfileChooserView::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT; |
2398 break; | 2400 break; |
2399 case AVATAR_BUBBLE_MODE_SIGNIN: | 2401 case AVATAR_BUBBLE_MODE_SIGNIN: |
2400 view_mode = ProfileChooserView::BUBBLE_VIEW_MODE_GAIA_SIGNIN; | 2402 view_mode = ProfileChooserView::BUBBLE_VIEW_MODE_GAIA_SIGNIN; |
2401 break; | 2403 break; |
2402 case AVATAR_BUBBLE_MODE_REAUTH: | 2404 case AVATAR_BUBBLE_MODE_REAUTH: |
2403 view_mode = ProfileChooserView::BUBBLE_VIEW_MODE_GAIA_REAUTH; | 2405 view_mode = ProfileChooserView::BUBBLE_VIEW_MODE_GAIA_REAUTH; |
2404 break; | 2406 break; |
2405 default: | 2407 default: |
2406 view_mode = ProfileChooserView::BUBBLE_VIEW_MODE_PROFILE_CHOOSER; | 2408 view_mode = ProfileChooserView::BUBBLE_VIEW_MODE_PROFILE_CHOOSER; |
2407 break; | 2409 break; |
2408 } | 2410 } |
2409 | |
2410 ProfileChooserView::ShowBubble( | 2411 ProfileChooserView::ShowBubble( |
2411 view_mode, button, views::BubbleBorder::TOP_RIGHT, | 2412 view_mode, service_type, button, views::BubbleBorder::TOP_RIGHT, |
2412 views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE, bounds, browser()); | 2413 views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE, bounds, browser()); |
2413 } | 2414 } |
2414 } else { | 2415 } else { |
2415 views::BubbleBorder::Arrow arrow = views::BubbleBorder::TOP_RIGHT; | 2416 views::BubbleBorder::Arrow arrow = views::BubbleBorder::TOP_RIGHT; |
2416 views::View* anchor_view = frame_->GetAvatarMenuButton(); | 2417 views::View* anchor_view = frame_->GetAvatarMenuButton(); |
2417 if (!anchor_view) | 2418 if (!anchor_view) |
2418 anchor_view = toolbar_->app_menu(); | 2419 anchor_view = toolbar_->app_menu(); |
2419 else if (!frame_->GetAvatarMenuButton()->button_on_right()) | 2420 else if (!frame_->GetAvatarMenuButton()->button_on_right()) |
2420 arrow = views::BubbleBorder::TOP_LEFT; | 2421 arrow = views::BubbleBorder::TOP_LEFT; |
2421 gfx::Point origin; | 2422 gfx::Point origin; |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2554 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { | 2555 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { |
2555 gfx::Point icon_bottom( | 2556 gfx::Point icon_bottom( |
2556 toolbar_->location_bar()->GetLocationBarAnchorPoint()); | 2557 toolbar_->location_bar()->GetLocationBarAnchorPoint()); |
2557 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); | 2558 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); |
2558 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); | 2559 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); |
2559 ConvertPointToTarget(infobar_container_, this, &infobar_top); | 2560 ConvertPointToTarget(infobar_container_, this, &infobar_top); |
2560 top_arrow_height = infobar_top.y() - icon_bottom.y(); | 2561 top_arrow_height = infobar_top.y() - icon_bottom.y(); |
2561 } | 2562 } |
2562 return top_arrow_height; | 2563 return top_arrow_height; |
2563 } | 2564 } |
OLD | NEW |