OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 #include "chrome/browser/ui/views/avatar_menu_button.h" | 47 #include "chrome/browser/ui/views/avatar_menu_button.h" |
48 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" | 48 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" |
49 #include "chrome/browser/ui/views/browser_dialogs.h" | 49 #include "chrome/browser/ui/views/browser_dialogs.h" |
50 #include "chrome/browser/ui/views/download/download_in_progress_dialog_view.h" | 50 #include "chrome/browser/ui/views/download/download_in_progress_dialog_view.h" |
51 #include "chrome/browser/ui/views/download/download_shelf_view.h" | 51 #include "chrome/browser/ui/views/download/download_shelf_view.h" |
52 #include "chrome/browser/ui/views/frame/browser_view_layout.h" | 52 #include "chrome/browser/ui/views/frame/browser_view_layout.h" |
53 #include "chrome/browser/ui/views/frame/contents_container.h" | 53 #include "chrome/browser/ui/views/frame/contents_container.h" |
54 #include "chrome/browser/ui/views/fullscreen_exit_bubble_views.h" | 54 #include "chrome/browser/ui/views/fullscreen_exit_bubble_views.h" |
55 #include "chrome/browser/ui/views/infobars/infobar_container_view.h" | 55 #include "chrome/browser/ui/views/infobars/infobar_container_view.h" |
56 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" | 56 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" |
| 57 #include "chrome/browser/ui/views/omnibox/omnibox_views.h" |
57 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" | 58 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" |
58 #include "chrome/browser/ui/views/password_generation_bubble_view.h" | 59 #include "chrome/browser/ui/views/password_generation_bubble_view.h" |
59 #include "chrome/browser/ui/views/status_bubble_views.h" | 60 #include "chrome/browser/ui/views/status_bubble_views.h" |
60 #include "chrome/browser/ui/views/tabs/browser_tab_strip_controller.h" | 61 #include "chrome/browser/ui/views/tabs/browser_tab_strip_controller.h" |
61 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 62 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
62 #include "chrome/browser/ui/views/toolbar_view.h" | 63 #include "chrome/browser/ui/views/toolbar_view.h" |
63 #include "chrome/browser/ui/views/update_recommended_message_box.h" | 64 #include "chrome/browser/ui/views/update_recommended_message_box.h" |
64 #include "chrome/browser/ui/views/website_settings_popup_view.h" | 65 #include "chrome/browser/ui/views/website_settings_popup_view.h" |
65 #include "chrome/browser/ui/webui/feedback_ui.h" | 66 #include "chrome/browser/ui/webui/feedback_ui.h" |
66 #include "chrome/browser/ui/window_sizer.h" | 67 #include "chrome/browser/ui/window_sizer.h" |
(...skipping 2034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2101 FullscreenType type, | 2102 FullscreenType type, |
2102 const GURL& url, | 2103 const GURL& url, |
2103 FullscreenExitBubbleType bubble_type) { | 2104 FullscreenExitBubbleType bubble_type) { |
2104 // Reduce jankiness during the following position changes by: | 2105 // Reduce jankiness during the following position changes by: |
2105 // * Hiding the window until it's in the final position | 2106 // * Hiding the window until it's in the final position |
2106 // * Ignoring all intervening Layout() calls, which resize the webpage and | 2107 // * Ignoring all intervening Layout() calls, which resize the webpage and |
2107 // thus are slow and look ugly | 2108 // thus are slow and look ugly |
2108 ignore_layout_ = true; | 2109 ignore_layout_ = true; |
2109 LocationBarView* location_bar = GetLocationBarView(); | 2110 LocationBarView* location_bar = GetLocationBarView(); |
2110 #if defined(OS_WIN) && !defined(USE_AURA) | 2111 #if defined(OS_WIN) && !defined(USE_AURA) |
2111 OmniboxViewWin* omnibox_view = | 2112 OmniboxViewWin* omnibox_win = |
2112 static_cast<OmniboxViewWin*>(location_bar->GetLocationEntry()); | 2113 GetOmniboxViewWin(location_bar->GetLocationEntry()); |
2113 #endif | 2114 #endif |
2114 | 2115 |
2115 if (type == FOR_METRO || !fullscreen) { | 2116 if (type == FOR_METRO || !fullscreen) { |
2116 // Hide the fullscreen bubble as soon as possible, since the mode toggle can | 2117 // Hide the fullscreen bubble as soon as possible, since the mode toggle can |
2117 // take enough time for the user to notice. | 2118 // take enough time for the user to notice. |
2118 fullscreen_bubble_.reset(); | 2119 fullscreen_bubble_.reset(); |
2119 } | 2120 } |
2120 | 2121 |
2121 if (fullscreen) { | 2122 if (fullscreen) { |
2122 // Move focus out of the location bar if necessary. | 2123 // Move focus out of the location bar if necessary. |
2123 views::FocusManager* focus_manager = GetFocusManager(); | 2124 views::FocusManager* focus_manager = GetFocusManager(); |
2124 DCHECK(focus_manager); | 2125 DCHECK(focus_manager); |
2125 // Look for focus in the location bar itself or any child view. | 2126 // Look for focus in the location bar itself or any child view. |
2126 if (location_bar->Contains(focus_manager->GetFocusedView())) | 2127 if (location_bar->Contains(focus_manager->GetFocusedView())) |
2127 focus_manager->ClearFocus(); | 2128 focus_manager->ClearFocus(); |
2128 | 2129 |
2129 #if defined(OS_WIN) && !defined(USE_AURA) | 2130 #if defined(OS_WIN) && !defined(USE_AURA) |
2130 // If we don't hide the edit and force it to not show until we come out of | 2131 if (omnibox_win) { |
2131 // fullscreen, then if the user was on the New Tab Page, the edit contents | 2132 // If we don't hide the edit and force it to not show until we come out of |
2132 // will appear atop the web contents once we go into fullscreen mode. This | 2133 // fullscreen, then if the user was on the New Tab Page, the edit contents |
2133 // has something to do with how we move the main window while it's hidden; | 2134 // will appear atop the web contents once we go into fullscreen mode. This |
2134 // if we don't hide the main window below, we don't get this problem. | 2135 // has something to do with how we move the main window while it's hidden; |
2135 omnibox_view->set_force_hidden(true); | 2136 // if we don't hide the main window below, we don't get this problem. |
2136 ShowWindow(omnibox_view->m_hWnd, SW_HIDE); | 2137 omnibox_win->set_force_hidden(true); |
| 2138 ShowWindow(omnibox_win->m_hWnd, SW_HIDE); |
| 2139 } |
2137 #endif | 2140 #endif |
2138 } | 2141 } |
2139 #if defined(OS_WIN) && !defined(USE_AURA) | 2142 #if defined(OS_WIN) && !defined(USE_AURA) |
2140 static_cast<views::NativeWidgetWin*>(frame_->native_widget())-> | 2143 static_cast<views::NativeWidgetWin*>(frame_->native_widget())-> |
2141 PushForceHidden(); | 2144 PushForceHidden(); |
2142 #endif | 2145 #endif |
2143 | 2146 |
2144 if (type == FOR_METRO) { | 2147 if (type == FOR_METRO) { |
2145 #if defined(OS_WIN) && !defined(USE_AURA) | 2148 #if defined(OS_WIN) && !defined(USE_AURA) |
2146 // Enter metro snap mode. | 2149 // Enter metro snap mode. |
2147 static_cast<views::NativeWidgetWin*>( | 2150 static_cast<views::NativeWidgetWin*>( |
2148 frame_->native_widget())->SetMetroSnapFullscreen(fullscreen); | 2151 frame_->native_widget())->SetMetroSnapFullscreen(fullscreen); |
2149 #endif | 2152 #endif |
2150 } else { | 2153 } else { |
2151 // Toggle fullscreen mode. | 2154 // Toggle fullscreen mode. |
2152 frame_->SetFullscreen(fullscreen); | 2155 frame_->SetFullscreen(fullscreen); |
2153 } | 2156 } |
2154 | 2157 |
2155 browser_->WindowFullscreenStateChanged(); | 2158 browser_->WindowFullscreenStateChanged(); |
2156 | 2159 |
2157 if (fullscreen) { | 2160 if (fullscreen) { |
2158 bool is_kiosk = | 2161 bool is_kiosk = |
2159 CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode); | 2162 CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode); |
2160 if (!is_kiosk && type != FOR_METRO) { | 2163 if (!is_kiosk && type != FOR_METRO) { |
2161 fullscreen_bubble_.reset(new FullscreenExitBubbleViews( | 2164 fullscreen_bubble_.reset(new FullscreenExitBubbleViews( |
2162 GetWidget(), browser_.get(), url, bubble_type)); | 2165 GetWidget(), browser_.get(), url, bubble_type)); |
2163 } | 2166 } |
2164 } else { | 2167 } else { |
2165 #if defined(OS_WIN) && !defined(USE_AURA) | 2168 #if defined(OS_WIN) && !defined(USE_AURA) |
2166 // Show the edit again since we're no longer in fullscreen mode. | 2169 if (omnibox_win) { |
2167 omnibox_view->set_force_hidden(false); | 2170 // Show the edit again since we're no longer in fullscreen mode. |
2168 ShowWindow(omnibox_view->m_hWnd, SW_SHOW); | 2171 omnibox_win->set_force_hidden(false); |
| 2172 ShowWindow(omnibox_win->m_hWnd, SW_SHOW); |
| 2173 } |
2169 #endif | 2174 #endif |
2170 } | 2175 } |
2171 | 2176 |
2172 // Undo our anti-jankiness hacks and force the window to re-layout now that | 2177 // Undo our anti-jankiness hacks and force the window to re-layout now that |
2173 // it's in its final position. | 2178 // it's in its final position. |
2174 ignore_layout_ = false; | 2179 ignore_layout_ = false; |
2175 Layout(); | 2180 Layout(); |
2176 #if defined(OS_WIN) && !defined(USE_AURA) | 2181 #if defined(OS_WIN) && !defined(USE_AURA) |
2177 static_cast<views::NativeWidgetWin*>(frame_->native_widget())-> | 2182 static_cast<views::NativeWidgetWin*>(frame_->native_widget())-> |
2178 PopForceHidden(); | 2183 PopForceHidden(); |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2471 this, | 2476 this, |
2472 tab_contents->web_contents()->GetRenderViewHost(), | 2477 tab_contents->web_contents()->GetRenderViewHost(), |
2473 password_generator, | 2478 password_generator, |
2474 browser_.get(), | 2479 browser_.get(), |
2475 tab_contents->password_manager()); | 2480 tab_contents->password_manager()); |
2476 | 2481 |
2477 views::BubbleDelegateView::CreateBubble(bubble); | 2482 views::BubbleDelegateView::CreateBubble(bubble); |
2478 bubble->SetAlignment(views::BubbleBorder::ALIGN_ARROW_TO_MID_ANCHOR); | 2483 bubble->SetAlignment(views::BubbleBorder::ALIGN_ARROW_TO_MID_ANCHOR); |
2479 bubble->Show(); | 2484 bubble->Show(); |
2480 } | 2485 } |
OLD | NEW |