Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(811)

Side by Side Diff: chrome/browser/ui/views/extensions/extension_popup.cc

Issue 196063002: Move wm/core to wm namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/extensions/extension_popup.h" 5 #include "chrome/browser/ui/views/extensions/extension_popup.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "chrome/browser/chrome_notification_types.h" 9 #include "chrome/browser/chrome_notification_types.h"
10 #include "chrome/browser/devtools/devtools_window.h" 10 #include "chrome/browser/devtools/devtools_window.h"
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 // DesktopNativeWidgetAura does not trigger the expected browser widget 191 // DesktopNativeWidgetAura does not trigger the expected browser widget
192 // [de]activation events when activating widgets in its own root window. 192 // [de]activation events when activating widgets in its own root window.
193 // This additional check handles those cases. See: http://crbug.com/320889 193 // This additional check handles those cases. See: http://crbug.com/320889
194 aura::Window* this_window = GetWidget()->GetNativeWindow(); 194 aura::Window* this_window = GetWidget()->GetNativeWindow();
195 aura::Window* anchor_window = anchor_widget()->GetNativeWindow(); 195 aura::Window* anchor_window = anchor_widget()->GetNativeWindow();
196 chrome::HostDesktopType host_desktop_type = 196 chrome::HostDesktopType host_desktop_type =
197 chrome::GetHostDesktopTypeForNativeWindow(this_window); 197 chrome::GetHostDesktopTypeForNativeWindow(this_window);
198 if (!inspect_with_devtools_ && anchor_window == gained_active && 198 if (!inspect_with_devtools_ && anchor_window == gained_active &&
199 host_desktop_type != chrome::HOST_DESKTOP_TYPE_ASH && 199 host_desktop_type != chrome::HOST_DESKTOP_TYPE_ASH &&
200 this_window->GetRootWindow() == anchor_window->GetRootWindow() && 200 this_window->GetRootWindow() == anchor_window->GetRootWindow() &&
201 views::corewm::GetTransientParent(gained_active) != this_window) 201 wm::GetTransientParent(gained_active) != this_window)
202 GetWidget()->Close(); 202 GetWidget()->Close();
203 } 203 }
204 #endif 204 #endif
205 205
206 void ExtensionPopup::ActiveTabChanged(content::WebContents* old_contents, 206 void ExtensionPopup::ActiveTabChanged(content::WebContents* old_contents,
207 content::WebContents* new_contents, 207 content::WebContents* new_contents,
208 int index, 208 int index,
209 int reason) { 209 int reason) {
210 GetWidget()->Close(); 210 GetWidget()->Close();
211 } 211 }
212 212
213 // static 213 // static
214 ExtensionPopup* ExtensionPopup::ShowPopup(const GURL& url, 214 ExtensionPopup* ExtensionPopup::ShowPopup(const GURL& url,
215 Browser* browser, 215 Browser* browser,
216 views::View* anchor_view, 216 views::View* anchor_view,
217 views::BubbleBorder::Arrow arrow, 217 views::BubbleBorder::Arrow arrow,
218 ShowAction show_action) { 218 ShowAction show_action) {
219 extensions::ExtensionViewHost* host = 219 extensions::ExtensionViewHost* host =
220 extensions::ExtensionViewHostFactory::CreatePopupHost(url, browser); 220 extensions::ExtensionViewHostFactory::CreatePopupHost(url, browser);
221 ExtensionPopup* popup = new ExtensionPopup(host, anchor_view, arrow, 221 ExtensionPopup* popup = new ExtensionPopup(host, anchor_view, arrow,
222 show_action); 222 show_action);
223 views::BubbleDelegateView::CreateBubble(popup); 223 views::BubbleDelegateView::CreateBubble(popup);
224 224
225 #if defined(USE_AURA) 225 #if defined(USE_AURA)
226 gfx::NativeView native_view = popup->GetWidget()->GetNativeView(); 226 gfx::NativeView native_view = popup->GetWidget()->GetNativeView();
227 views::corewm::SetWindowVisibilityAnimationType( 227 wm::SetWindowVisibilityAnimationType(
228 native_view, 228 native_view,
229 views::corewm::WINDOW_VISIBILITY_ANIMATION_TYPE_VERTICAL); 229 wm::WINDOW_VISIBILITY_ANIMATION_TYPE_VERTICAL);
230 views::corewm::SetWindowVisibilityAnimationVerticalPosition( 230 wm::SetWindowVisibilityAnimationVerticalPosition(
231 native_view, 231 native_view,
232 -3.0f); 232 -3.0f);
233 #endif 233 #endif
234 234
235 // If the host had somehow finished loading, then we'd miss the notification 235 // If the host had somehow finished loading, then we'd miss the notification
236 // and not show. This seems to happen in single-process mode. 236 // and not show. This seems to happen in single-process mode.
237 if (host->did_stop_loading()) 237 if (host->did_stop_loading())
238 popup->ShowBubble(); 238 popup->ShowBubble();
239 239
240 #if defined(USE_AURA) 240 #if defined(USE_AURA)
(...skipping 10 matching lines...) Expand all
251 GetWidget()->Show(); 251 GetWidget()->Show();
252 252
253 // Focus on the host contents when the bubble is first shown. 253 // Focus on the host contents when the bubble is first shown.
254 host()->host_contents()->GetView()->Focus(); 254 host()->host_contents()->GetView()->Focus();
255 255
256 if (inspect_with_devtools_) { 256 if (inspect_with_devtools_) {
257 DevToolsWindow::OpenDevToolsWindow(host()->render_view_host(), 257 DevToolsWindow::OpenDevToolsWindow(host()->render_view_host(),
258 DevToolsToggleAction::ShowConsole()); 258 DevToolsToggleAction::ShowConsole());
259 } 259 }
260 } 260 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698