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" |
11 #include "base/i18n/rtl.h" | 11 #include "base/i18n/rtl.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
14 #include "base/prefs/pref_service.h" | 14 #include "base/prefs/pref_service.h" |
15 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
16 #include "chrome/app/chrome_command_ids.h" | 16 #include "chrome/app/chrome_command_ids.h" |
17 #include "chrome/app/chrome_dll_resource.h" | 17 #include "chrome/app/chrome_dll_resource.h" |
18 #include "chrome/browser/app_mode/app_mode_utils.h" | 18 #include "chrome/browser/app_mode/app_mode_utils.h" |
19 #include "chrome/browser/bookmarks/bookmark_stats.h" | 19 #include "chrome/browser/bookmarks/bookmark_stats.h" |
20 #include "chrome/browser/browser_process.h" | 20 #include "chrome/browser/browser_process.h" |
21 #include "chrome/browser/chrome_notification_types.h" | 21 #include "chrome/browser/chrome_notification_types.h" |
22 #include "chrome/browser/extensions/tab_helper.h" | 22 #include "chrome/browser/extensions/tab_helper.h" |
23 #include "chrome/browser/infobars/infobar_service.h" | 23 #include "chrome/browser/infobars/infobar_service.h" |
24 #include "chrome/browser/native_window_notification_source.h" | 24 #include "chrome/browser/native_window_notification_source.h" |
25 #include "chrome/browser/password_manager/password_manager.h" | 25 #include "chrome/browser/password_manager/password_manager.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_info_cache.h" | 28 #include "chrome/browser/profiles/profile_info_cache.h" |
29 #include "chrome/browser/profiles/profile_manager.h" | 29 #include "chrome/browser/profiles/profile_manager.h" |
| 30 #include "chrome/browser/profiles/profiles_state.h" |
30 #include "chrome/browser/search/search.h" | 31 #include "chrome/browser/search/search.h" |
31 #include "chrome/browser/sessions/tab_restore_service.h" | 32 #include "chrome/browser/sessions/tab_restore_service.h" |
32 #include "chrome/browser/sessions/tab_restore_service_factory.h" | 33 #include "chrome/browser/sessions/tab_restore_service_factory.h" |
33 #include "chrome/browser/speech/tts_controller.h" | 34 #include "chrome/browser/speech/tts_controller.h" |
34 #include "chrome/browser/themes/theme_properties.h" | 35 #include "chrome/browser/themes/theme_properties.h" |
35 #include "chrome/browser/themes/theme_service_factory.h" | 36 #include "chrome/browser/themes/theme_service_factory.h" |
36 #include "chrome/browser/translate/translate_tab_helper.h" | 37 #include "chrome/browser/translate/translate_tab_helper.h" |
37 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h" | 38 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h" |
38 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog_queue.h" | 39 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog_queue.h" |
39 #include "chrome/browser/ui/bookmarks/bookmark_bar_constants.h" | 40 #include "chrome/browser/ui/bookmarks/bookmark_bar_constants.h" |
(...skipping 30 matching lines...) Expand all Loading... |
70 #include "chrome/browser/ui/views/frame/contents_container.h" | 71 #include "chrome/browser/ui/views/frame/contents_container.h" |
71 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" | 72 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" |
72 #include "chrome/browser/ui/views/frame/top_container_view.h" | 73 #include "chrome/browser/ui/views/frame/top_container_view.h" |
73 #include "chrome/browser/ui/views/fullscreen_exit_bubble_views.h" | 74 #include "chrome/browser/ui/views/fullscreen_exit_bubble_views.h" |
74 #include "chrome/browser/ui/views/infobars/infobar_container_view.h" | 75 #include "chrome/browser/ui/views/infobars/infobar_container_view.h" |
75 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 76 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
76 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" | 77 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" |
77 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" | 78 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" |
78 #include "chrome/browser/ui/views/omnibox/omnibox_views.h" | 79 #include "chrome/browser/ui/views/omnibox/omnibox_views.h" |
79 #include "chrome/browser/ui/views/password_generation_bubble_view.h" | 80 #include "chrome/browser/ui/views/password_generation_bubble_view.h" |
| 81 #include "chrome/browser/ui/views/profile_chooser_view.h" |
80 #include "chrome/browser/ui/views/status_bubble_views.h" | 82 #include "chrome/browser/ui/views/status_bubble_views.h" |
81 #include "chrome/browser/ui/views/tabs/browser_tab_strip_controller.h" | 83 #include "chrome/browser/ui/views/tabs/browser_tab_strip_controller.h" |
82 #include "chrome/browser/ui/views/tabs/tab.h" | 84 #include "chrome/browser/ui/views/tabs/tab.h" |
83 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 85 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
84 #include "chrome/browser/ui/views/toolbar_view.h" | 86 #include "chrome/browser/ui/views/toolbar_view.h" |
85 #include "chrome/browser/ui/views/translate/translate_bubble_view.h" | 87 #include "chrome/browser/ui/views/translate/translate_bubble_view.h" |
86 #include "chrome/browser/ui/views/update_recommended_message_box.h" | 88 #include "chrome/browser/ui/views/update_recommended_message_box.h" |
87 #include "chrome/browser/ui/views/website_settings/website_settings_popup_view.h
" | 89 #include "chrome/browser/ui/views/website_settings/website_settings_popup_view.h
" |
88 #include "chrome/browser/ui/window_sizer/window_sizer.h" | 90 #include "chrome/browser/ui/window_sizer/window_sizer.h" |
89 #include "chrome/common/chrome_switches.h" | 91 #include "chrome/common/chrome_switches.h" |
(...skipping 2476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2566 const gfx::Rect& rect) { | 2568 const gfx::Rect& rect) { |
2567 gfx::Point origin(rect.origin()); | 2569 gfx::Point origin(rect.origin()); |
2568 views::View::ConvertPointToScreen(GetTabContentsContainerView(), &origin); | 2570 views::View::ConvertPointToScreen(GetTabContentsContainerView(), &origin); |
2569 gfx::Rect bounds(origin, rect.size()); | 2571 gfx::Rect bounds(origin, rect.size()); |
2570 | 2572 |
2571 AvatarMenuBubbleView::ShowBubble(this, views::BubbleBorder::TOP_RIGHT, | 2573 AvatarMenuBubbleView::ShowBubble(this, views::BubbleBorder::TOP_RIGHT, |
2572 views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE, bounds, browser_.get()); | 2574 views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE, bounds, browser_.get()); |
2573 } | 2575 } |
2574 | 2576 |
2575 void BrowserView::ShowAvatarBubbleFromAvatarButton() { | 2577 void BrowserView::ShowAvatarBubbleFromAvatarButton() { |
2576 AvatarMenuButton* button = frame_->GetAvatarMenuButton(); | 2578 if (profiles::IsNewProfileManagementEnabled()) { |
2577 if (button) | 2579 NewAvatarButton* button = frame_->GetNewAvatarMenuButton(); |
2578 button->ShowAvatarBubble(); | 2580 if (button) { |
| 2581 gfx::Point origin; |
| 2582 views::View::ConvertPointToScreen(button, &origin); |
| 2583 gfx::Rect bounds(origin, size()); |
| 2584 |
| 2585 ProfileChooserView::ShowBubble( |
| 2586 button, views::BubbleBorder::TOP_RIGHT, |
| 2587 views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE, bounds, browser()); |
| 2588 } |
| 2589 } else { |
| 2590 AvatarMenuButton* button = frame_->GetAvatarMenuButton(); |
| 2591 if (button) |
| 2592 button->ShowAvatarBubble(); |
| 2593 } |
2579 } | 2594 } |
2580 | 2595 |
2581 void BrowserView::ShowPasswordGenerationBubble( | 2596 void BrowserView::ShowPasswordGenerationBubble( |
2582 const gfx::Rect& rect, | 2597 const gfx::Rect& rect, |
2583 const autofill::PasswordForm& form, | 2598 const autofill::PasswordForm& form, |
2584 autofill::PasswordGenerator* password_generator) { | 2599 autofill::PasswordGenerator* password_generator) { |
2585 // Create a rect in the content bounds that the bubble will point to. | 2600 // Create a rect in the content bounds that the bubble will point to. |
2586 gfx::Point origin(rect.origin()); | 2601 gfx::Point origin(rect.origin()); |
2587 views::View::ConvertPointToScreen(GetTabContentsContainerView(), &origin); | 2602 views::View::ConvertPointToScreen(GetTabContentsContainerView(), &origin); |
2588 gfx::Rect bounds(origin, rect.size()); | 2603 gfx::Rect bounds(origin, rect.size()); |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2707 // The +1 in the next line creates a 1-px gap between icon and arrow tip. | 2722 // The +1 in the next line creates a 1-px gap between icon and arrow tip. |
2708 gfx::Point icon_bottom(0, location_icon_view->GetImageBounds().bottom() - | 2723 gfx::Point icon_bottom(0, location_icon_view->GetImageBounds().bottom() - |
2709 LocationBarView::kIconInternalPadding + 1); | 2724 LocationBarView::kIconInternalPadding + 1); |
2710 ConvertPointToTarget(location_icon_view, this, &icon_bottom); | 2725 ConvertPointToTarget(location_icon_view, this, &icon_bottom); |
2711 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); | 2726 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); |
2712 ConvertPointToTarget(infobar_container_, this, &infobar_top); | 2727 ConvertPointToTarget(infobar_container_, this, &infobar_top); |
2713 top_arrow_height = infobar_top.y() - icon_bottom.y(); | 2728 top_arrow_height = infobar_top.y() - icon_bottom.y(); |
2714 } | 2729 } |
2715 return top_arrow_height; | 2730 return top_arrow_height; |
2716 } | 2731 } |
OLD | NEW |