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/extension_util.h" | 22 #include "chrome/browser/extensions/extension_util.h" |
23 #include "chrome/browser/extensions/tab_helper.h" | 23 #include "chrome/browser/extensions/tab_helper.h" |
24 #include "chrome/browser/infobars/infobar_service.h" | 24 #include "chrome/browser/infobars/infobar_service.h" |
25 #include "chrome/browser/native_window_notification_source.h" | 25 #include "chrome/browser/native_window_notification_source.h" |
26 #include "chrome/browser/password_manager/chrome_password_manager_client.h" | 26 #include "chrome/browser/password_manager/chrome_password_manager_client.h" |
msw
2014/09/06 02:15:26
Can this be removed?
Garrett Casto
2014/09/10 00:10:16
Yes, done.
| |
27 #include "chrome/browser/profiles/avatar_menu.h" | 27 #include "chrome/browser/profiles/avatar_menu.h" |
28 #include "chrome/browser/profiles/profile.h" | 28 #include "chrome/browser/profiles/profile.h" |
29 #include "chrome/browser/profiles/profile_avatar_icon_util.h" | 29 #include "chrome/browser/profiles/profile_avatar_icon_util.h" |
30 #include "chrome/browser/profiles/profile_info_cache.h" | 30 #include "chrome/browser/profiles/profile_info_cache.h" |
31 #include "chrome/browser/profiles/profile_manager.h" | 31 #include "chrome/browser/profiles/profile_manager.h" |
32 #include "chrome/browser/profiles/profiles_state.h" | 32 #include "chrome/browser/profiles/profiles_state.h" |
33 #include "chrome/browser/search/search.h" | 33 #include "chrome/browser/search/search.h" |
34 #include "chrome/browser/sessions/tab_restore_service.h" | 34 #include "chrome/browser/sessions/tab_restore_service.h" |
35 #include "chrome/browser/sessions/tab_restore_service_factory.h" | 35 #include "chrome/browser/sessions/tab_restore_service_factory.h" |
36 #include "chrome/browser/signin/signin_header_helper.h" | 36 #include "chrome/browser/signin/signin_header_helper.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
72 #include "chrome/browser/ui/views/frame/contents_layout_manager.h" | 72 #include "chrome/browser/ui/views/frame/contents_layout_manager.h" |
73 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" | 73 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" |
74 #include "chrome/browser/ui/views/frame/native_browser_frame_factory.h" | 74 #include "chrome/browser/ui/views/frame/native_browser_frame_factory.h" |
75 #include "chrome/browser/ui/views/frame/top_container_view.h" | 75 #include "chrome/browser/ui/views/frame/top_container_view.h" |
76 #include "chrome/browser/ui/views/frame/web_contents_close_handler.h" | 76 #include "chrome/browser/ui/views/frame/web_contents_close_handler.h" |
77 #include "chrome/browser/ui/views/fullscreen_exit_bubble_views.h" | 77 #include "chrome/browser/ui/views/fullscreen_exit_bubble_views.h" |
78 #include "chrome/browser/ui/views/infobars/infobar_container_view.h" | 78 #include "chrome/browser/ui/views/infobars/infobar_container_view.h" |
79 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 79 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
80 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" | 80 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" |
81 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" | 81 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" |
82 #include "chrome/browser/ui/views/password_generation_bubble_view.h" | |
83 #include "chrome/browser/ui/views/profiles/avatar_menu_bubble_view.h" | 82 #include "chrome/browser/ui/views/profiles/avatar_menu_bubble_view.h" |
84 #include "chrome/browser/ui/views/profiles/avatar_menu_button.h" | 83 #include "chrome/browser/ui/views/profiles/avatar_menu_button.h" |
85 #include "chrome/browser/ui/views/profiles/profile_chooser_view.h" | 84 #include "chrome/browser/ui/views/profiles/profile_chooser_view.h" |
86 #include "chrome/browser/ui/views/settings_api_bubble_helper_views.h" | 85 #include "chrome/browser/ui/views/settings_api_bubble_helper_views.h" |
87 #include "chrome/browser/ui/views/status_bubble_views.h" | 86 #include "chrome/browser/ui/views/status_bubble_views.h" |
88 #include "chrome/browser/ui/views/tabs/browser_tab_strip_controller.h" | 87 #include "chrome/browser/ui/views/tabs/browser_tab_strip_controller.h" |
89 #include "chrome/browser/ui/views/tabs/tab.h" | 88 #include "chrome/browser/ui/views/tabs/tab.h" |
90 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 89 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
91 #include "chrome/browser/ui/views/toolbar/reload_button.h" | 90 #include "chrome/browser/ui/views/toolbar/reload_button.h" |
92 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" | 91 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" |
93 #include "chrome/browser/ui/views/translate/translate_bubble_view.h" | 92 #include "chrome/browser/ui/views/translate/translate_bubble_view.h" |
94 #include "chrome/browser/ui/views/update_recommended_message_box.h" | 93 #include "chrome/browser/ui/views/update_recommended_message_box.h" |
95 #include "chrome/browser/ui/views/website_settings/permissions_bubble_view.h" | 94 #include "chrome/browser/ui/views/website_settings/permissions_bubble_view.h" |
96 #include "chrome/browser/ui/views/website_settings/website_settings_popup_view.h " | 95 #include "chrome/browser/ui/views/website_settings/website_settings_popup_view.h " |
97 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h" | 96 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h" |
98 #include "chrome/browser/ui/window_sizer/window_sizer.h" | 97 #include "chrome/browser/ui/window_sizer/window_sizer.h" |
99 #include "chrome/common/chrome_switches.h" | 98 #include "chrome/common/chrome_switches.h" |
100 #include "chrome/common/pref_names.h" | 99 #include "chrome/common/pref_names.h" |
101 #include "chrome/common/url_constants.h" | 100 #include "chrome/common/url_constants.h" |
102 #include "chrome/grit/chromium_strings.h" | 101 #include "chrome/grit/chromium_strings.h" |
103 #include "chrome/grit/generated_resources.h" | 102 #include "chrome/grit/generated_resources.h" |
104 #include "chrome/grit/locale_settings.h" | 103 #include "chrome/grit/locale_settings.h" |
105 #include "components/password_manager/core/browser/password_manager.h" | 104 #include "components/password_manager/core/browser/password_manager.h" |
msw
2014/09/06 02:15:26
Can this be removed?
Garrett Casto
2014/09/10 00:10:16
Done.
| |
106 #include "components/signin/core/common/profile_management_switches.h" | 105 #include "components/signin/core/common/profile_management_switches.h" |
107 #include "components/translate/core/browser/language_state.h" | 106 #include "components/translate/core/browser/language_state.h" |
108 #include "content/app/resources/grit/content_resources.h" | 107 #include "content/app/resources/grit/content_resources.h" |
109 #include "content/public/browser/download_manager.h" | 108 #include "content/public/browser/download_manager.h" |
110 #include "content/public/browser/native_web_keyboard_event.h" | 109 #include "content/public/browser/native_web_keyboard_event.h" |
111 #include "content/public/browser/notification_service.h" | 110 #include "content/public/browser/notification_service.h" |
112 #include "content/public/browser/render_frame_host.h" | 111 #include "content/public/browser/render_frame_host.h" |
113 #include "content/public/browser/render_view_host.h" | 112 #include "content/public/browser/render_view_host.h" |
114 #include "content/public/browser/user_metrics.h" | 113 #include "content/public/browser/user_metrics.h" |
115 #include "content/public/browser/web_contents.h" | 114 #include "content/public/browser/web_contents.h" |
(...skipping 2311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2427 gfx::Rect bounds(origin, anchor_view->size()); | 2426 gfx::Rect bounds(origin, anchor_view->size()); |
2428 views::BubbleBorder::ArrowPaintType arrow_paint_type = | 2427 views::BubbleBorder::ArrowPaintType arrow_paint_type = |
2429 ShouldHideUIForFullscreen() ? views::BubbleBorder::PAINT_TRANSPARENT : | 2428 ShouldHideUIForFullscreen() ? views::BubbleBorder::PAINT_TRANSPARENT : |
2430 views::BubbleBorder::PAINT_NORMAL; | 2429 views::BubbleBorder::PAINT_NORMAL; |
2431 AvatarMenuBubbleView::ShowBubble(anchor_view, arrow, arrow_paint_type, | 2430 AvatarMenuBubbleView::ShowBubble(anchor_view, arrow, arrow_paint_type, |
2432 alignment, bounds, browser()); | 2431 alignment, bounds, browser()); |
2433 ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::ICON_AVATAR_BUBBLE); | 2432 ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::ICON_AVATAR_BUBBLE); |
2434 } | 2433 } |
2435 } | 2434 } |
2436 | 2435 |
2437 void BrowserView::ShowPasswordGenerationBubble( | |
2438 const gfx::Rect& rect, | |
2439 const autofill::PasswordForm& form, | |
2440 autofill::PasswordGenerator* password_generator) { | |
2441 // Create a rect in the content bounds that the bubble will point to. | |
2442 gfx::Point origin(rect.origin()); | |
2443 views::View::ConvertPointToScreen(GetTabContentsContainerView(), &origin); | |
2444 gfx::Rect bounds(origin, rect.size()); | |
2445 | |
2446 // Create the bubble. | |
2447 WebContents* web_contents = GetActiveWebContents(); | |
2448 if (!web_contents) | |
2449 return; | |
2450 | |
2451 PasswordGenerationBubbleView* bubble = new PasswordGenerationBubbleView( | |
2452 form, | |
2453 bounds, | |
2454 this, | |
2455 web_contents->GetRenderViewHost(), | |
2456 ChromePasswordManagerClient::GetManagerFromWebContents(web_contents), | |
2457 password_generator, | |
2458 GetWidget()->GetThemeProvider()); | |
2459 | |
2460 views::BubbleDelegateView::CreateBubble(bubble); | |
2461 bubble->SetAlignment(views::BubbleBorder::ALIGN_ARROW_TO_MID_ANCHOR); | |
2462 bubble->GetWidget()->Show(); | |
2463 } | |
2464 | |
2465 void BrowserView::OverscrollUpdate(int delta_y) { | 2436 void BrowserView::OverscrollUpdate(int delta_y) { |
2466 if (scroll_end_effect_controller_) | 2437 if (scroll_end_effect_controller_) |
2467 scroll_end_effect_controller_->OverscrollUpdate(delta_y); | 2438 scroll_end_effect_controller_->OverscrollUpdate(delta_y); |
2468 } | 2439 } |
2469 | 2440 |
2470 int BrowserView::GetRenderViewHeightInsetWithDetachedBookmarkBar() { | 2441 int BrowserView::GetRenderViewHeightInsetWithDetachedBookmarkBar() { |
2471 if (browser_->bookmark_bar_state() != BookmarkBar::DETACHED || | 2442 if (browser_->bookmark_bar_state() != BookmarkBar::DETACHED || |
2472 !bookmark_bar_view_.get() || !bookmark_bar_view_->IsDetached()) { | 2443 !bookmark_bar_view_.get() || !bookmark_bar_view_->IsDetached()) { |
2473 return 0; | 2444 return 0; |
2474 } | 2445 } |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2545 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { | 2516 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { |
2546 gfx::Point icon_bottom( | 2517 gfx::Point icon_bottom( |
2547 toolbar_->location_bar()->GetLocationBarAnchorPoint()); | 2518 toolbar_->location_bar()->GetLocationBarAnchorPoint()); |
2548 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); | 2519 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); |
2549 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); | 2520 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); |
2550 ConvertPointToTarget(infobar_container_, this, &infobar_top); | 2521 ConvertPointToTarget(infobar_container_, this, &infobar_top); |
2551 top_arrow_height = infobar_top.y() - icon_bottom.y(); | 2522 top_arrow_height = infobar_top.y() - icon_bottom.y(); |
2552 } | 2523 } |
2553 return top_arrow_height; | 2524 return top_arrow_height; |
2554 } | 2525 } |
OLD | NEW |