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

Side by Side Diff: chrome/browser/ui/views/chrome_views_delegate.cc

Issue 11829040: Fix the content_browsertests everywhere maybe. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: And fix the final ExtensionApiTest.AlertBasic case. Created 7 years, 11 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/chrome_views_delegate.h" 5 #include "chrome/browser/ui/views/chrome_views_delegate.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
11 #include "chrome/browser/browser_process.h" 11 #include "chrome/browser/browser_process.h"
12 #include "chrome/browser/event_disposition.h" 12 #include "chrome/browser/event_disposition.h"
13 #include "chrome/browser/prefs/pref_service.h" 13 #include "chrome/browser/prefs/pref_service.h"
14 #include "chrome/browser/prefs/scoped_user_pref_update.h" 14 #include "chrome/browser/prefs/scoped_user_pref_update.h"
15 #include "chrome/browser/profiles/profile_manager.h" 15 #include "chrome/browser/profiles/profile_manager.h"
16 #include "chrome/browser/ui/views/accessibility/accessibility_event_router_views .h" 16 #include "chrome/browser/ui/views/accessibility/accessibility_event_router_views .h"
17 #include "chrome/common/pref_names.h" 17 #include "chrome/common/pref_names.h"
18 #include "ui/gfx/rect.h" 18 #include "ui/gfx/rect.h"
19 #include "ui/gfx/screen.h" 19 #include "ui/gfx/screen.h"
20 #include "ui/views/widget/native_widget.h" 20 #include "ui/views/widget/native_widget.h"
21 #include "ui/views/widget/widget.h" 21 #include "ui/views/widget/widget.h"
22 22
23 #if defined(OS_WIN) 23 #if defined(OS_WIN)
24 #include "chrome/browser/app_icon_win.h" 24 #include "chrome/browser/app_icon_win.h"
25 #endif 25 #endif
26 26
27 #if defined(USE_AURA)
28 #include "ui/aura/root_window.h"
29 #endif
30
27 #if defined(USE_AURA) && !defined(OS_CHROMEOS) 31 #if defined(USE_AURA) && !defined(OS_CHROMEOS)
28 #include "chrome/browser/ui/host_desktop.h" 32 #include "chrome/browser/ui/host_desktop.h"
29 #include "ui/aura/root_window.h"
30 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" 33 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
31 #include "ui/views/widget/native_widget_aura.h" 34 #include "ui/views/widget/native_widget_aura.h"
32 #endif 35 #endif
33 36
34 #if defined(USE_ASH) 37 #if defined(USE_ASH)
35 #include "ash/shell.h" 38 #include "ash/shell.h"
36 #include "chrome/browser/ui/ash/ash_init.h" 39 #include "chrome/browser/ui/ash/ash_init.h"
37 #include "chrome/browser/ui/ash/ash_util.h" 40 #include "chrome/browser/ui/ash/ash_util.h"
38 #endif 41 #endif
39 42
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 170
168 content::WebContents* ChromeViewsDelegate::CreateWebContents( 171 content::WebContents* ChromeViewsDelegate::CreateWebContents(
169 content::BrowserContext* browser_context, 172 content::BrowserContext* browser_context,
170 content::SiteInstance* site_instance) { 173 content::SiteInstance* site_instance) {
171 return NULL; 174 return NULL;
172 } 175 }
173 176
174 void ChromeViewsDelegate::OnBeforeWidgetInit( 177 void ChromeViewsDelegate::OnBeforeWidgetInit(
175 views::Widget::InitParams* params, 178 views::Widget::InitParams* params,
176 views::internal::NativeWidgetDelegate* delegate) { 179 views::internal::NativeWidgetDelegate* delegate) {
177 #if defined(USE_AURA) && !defined(OS_CHROMEOS)
178 // If we already have a native_widget, we don't have to try to come 180 // If we already have a native_widget, we don't have to try to come
179 // up with one. 181 // up with one.
180 if (params->native_widget) 182 if (params->native_widget)
181 return; 183 return;
182 184
185 #if defined(OS_CHROMEOS)
186 // When we are doing straight chromeos builds, we still need to handle the
187 // toplevel window case.
188 if (params->parent == NULL && params->context == NULL && params->top_level)
189 params->context = ash::Shell::GetPrimaryRootWindow();
190 #elif defined(USE_AURA)
183 // While the majority of the time, context wasn't plumbed through due to the 191 // While the majority of the time, context wasn't plumbed through due to the
184 // existence of a global StackingClient, if this window is a toplevel, it's 192 // existence of a global StackingClient, if this window is a toplevel, it's
185 // possible that there is no contextual state that we can use. 193 // possible that there is no contextual state that we can use.
186 if (params->parent == NULL && params->context == NULL && params->top_level) { 194 if (params->parent == NULL && params->context == NULL && params->top_level) {
187 // We need to make a decision about where to place this window based on the 195 // We need to make a decision about where to place this window based on the
188 // desktop type. 196 // desktop type.
189 switch (chrome::GetActiveDesktop()) { 197 switch (chrome::GetActiveDesktop()) {
190 case chrome::HOST_DESKTOP_TYPE_NATIVE: 198 case chrome::HOST_DESKTOP_TYPE_NATIVE:
191 // If we're native, we should give this window its own toplevel desktop 199 // If we're native, we should give this window its own toplevel desktop
192 // widget. 200 // widget.
(...skipping 16 matching lines...) Expand all
209 // should remove this check here. 217 // should remove this check here.
210 gfx::NativeView to_check = 218 gfx::NativeView to_check =
211 params->context ? params->context : params->parent; 219 params->context ? params->context : params->parent;
212 if (chrome::GetHostDesktopTypeForNativeView(to_check) == 220 if (chrome::GetHostDesktopTypeForNativeView(to_check) ==
213 chrome::HOST_DESKTOP_TYPE_NATIVE) { 221 chrome::HOST_DESKTOP_TYPE_NATIVE) {
214 params->native_widget = new views::DesktopNativeWidgetAura(delegate); 222 params->native_widget = new views::DesktopNativeWidgetAura(delegate);
215 } 223 }
216 } 224 }
217 #endif 225 #endif
218 } 226 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698