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

Side by Side Diff: content/shell/shell_aura.cc

Issue 11829040: Fix the content_browsertests everywhere maybe. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix SimpleMessageBoxViews asan failure. 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 "content/shell/shell.h" 5 #include "content/shell/shell.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "content/public/browser/web_contents.h" 9 #include "content/public/browser/web_contents.h"
10 #include "ui/aura/env.h" 10 #include "ui/aura/env.h"
(...skipping 11 matching lines...) Expand all
22 #include "ui/views/layout/fill_layout.h" 22 #include "ui/views/layout/fill_layout.h"
23 #include "ui/views/layout/grid_layout.h" 23 #include "ui/views/layout/grid_layout.h"
24 #include "ui/views/view.h" 24 #include "ui/views/view.h"
25 #include "ui/views/test/desktop_test_views_delegate.h" 25 #include "ui/views/test/desktop_test_views_delegate.h"
26 #include "ui/views/widget/desktop_aura/desktop_screen.h" 26 #include "ui/views/widget/desktop_aura/desktop_screen.h"
27 #include "ui/views/widget/widget.h" 27 #include "ui/views/widget/widget.h"
28 #include "ui/views/widget/widget_delegate.h" 28 #include "ui/views/widget/widget_delegate.h"
29 29
30 #if defined(OS_CHROMEOS) 30 #if defined(OS_CHROMEOS)
31 #include "chromeos/dbus/dbus_thread_manager.h" 31 #include "chromeos/dbus/dbus_thread_manager.h"
32 #include "content/shell/shell_stacking_client_ash.h" 32 #include "content/shell/minimal_ash.h"
33 #include "ui/aura/test/test_screen.h" 33 #include "ui/aura/test/test_screen.h"
34 #else
35 #include "ui/views/widget/desktop_aura/desktop_stacking_client.h"
36 #endif 34 #endif
37 35
38 // ViewDelegate implementation for aura content shell 36 // ViewDelegate implementation for aura content shell
39 class ShellViewsDelegateAura : public views::DesktopTestViewsDelegate { 37 class ShellViewsDelegateAura : public views::DesktopTestViewsDelegate {
40 public: 38 public:
41 ShellViewsDelegateAura() : use_transparent_windows_(false) { 39 ShellViewsDelegateAura() : use_transparent_windows_(false) {
42 } 40 }
43 41
44 virtual ~ShellViewsDelegateAura() { 42 virtual ~ShellViewsDelegateAura() {
45 ViewsDelegate::views_delegate = NULL; 43 ViewsDelegate::views_delegate = NULL;
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 265
268 DISALLOW_COPY_AND_ASSIGN(ShellWindowDelegateView); 266 DISALLOW_COPY_AND_ASSIGN(ShellWindowDelegateView);
269 }; 267 };
270 268
271 } // namespace views 269 } // namespace views
272 270
273 using views::ShellWindowDelegateView; 271 using views::ShellWindowDelegateView;
274 272
275 namespace content { 273 namespace content {
276 274
277 aura::client::StackingClient* Shell::stacking_client_ = NULL; 275 #if defined(OS_CHROMEOS)
276 MinimalAsh* Shell::minimal_ash_ = NULL;
277 #endif
278 views::ViewsDelegate* Shell::views_delegate_ = NULL; 278 views::ViewsDelegate* Shell::views_delegate_ = NULL;
279 279
280 // static 280 // static
281 void Shell::PlatformInitialize() { 281 void Shell::PlatformInitialize() {
282 #if defined(OS_CHROMEOS) 282 #if defined(OS_CHROMEOS)
283 chromeos::DBusThreadManager::Initialize(); 283 chromeos::DBusThreadManager::Initialize();
284 #endif 284 #endif
285 #if defined(OS_CHROMEOS) 285 #if defined(OS_CHROMEOS)
286 stacking_client_ = new content::ShellStackingClientAsh();
287 gfx::Screen::SetScreenInstance( 286 gfx::Screen::SetScreenInstance(
288 gfx::SCREEN_TYPE_NATIVE, new aura::TestScreen); 287 gfx::SCREEN_TYPE_NATIVE, new aura::TestScreen);
288 minimal_ash_ = new content::MinimalAsh();
289 #else 289 #else
290 stacking_client_ = new views::DesktopStackingClient();
291 gfx::Screen::SetScreenInstance( 290 gfx::Screen::SetScreenInstance(
292 gfx::SCREEN_TYPE_NATIVE, views::CreateDesktopScreen()); 291 gfx::SCREEN_TYPE_NATIVE, views::CreateDesktopScreen());
293 #endif 292 #endif
294 aura::client::SetStackingClient(stacking_client_);
295 views_delegate_ = new ShellViewsDelegateAura(); 293 views_delegate_ = new ShellViewsDelegateAura();
296 } 294 }
297 295
298 void Shell::PlatformExit() { 296 void Shell::PlatformExit() {
299 if (stacking_client_) 297 #if defined(OS_CHROMEOS)
300 delete stacking_client_; 298 if (minimal_ash_)
299 delete minimal_ash_;
300 #endif
301 if (views_delegate_) 301 if (views_delegate_)
302 delete views_delegate_; 302 delete views_delegate_;
303 #if defined(OS_CHROMEOS) 303 #if defined(OS_CHROMEOS)
304 chromeos::DBusThreadManager::Shutdown(); 304 chromeos::DBusThreadManager::Shutdown();
305 #endif 305 #endif
306 aura::Env::DeleteInstance(); 306 aura::Env::DeleteInstance();
307 } 307 }
308 308
309 void Shell::PlatformCleanUp() { 309 void Shell::PlatformCleanUp() {
310 } 310 }
(...skipping 16 matching lines...) Expand all
327 void Shell::PlatformSetAddressBarURL(const GURL& url) { 327 void Shell::PlatformSetAddressBarURL(const GURL& url) {
328 ShellWindowDelegateView* delegate_view = 328 ShellWindowDelegateView* delegate_view =
329 static_cast<ShellWindowDelegateView*>(window_widget_->widget_delegate()); 329 static_cast<ShellWindowDelegateView*>(window_widget_->widget_delegate());
330 delegate_view->SetAddressBarURL(url); 330 delegate_view->SetAddressBarURL(url);
331 } 331 }
332 332
333 void Shell::PlatformSetIsLoading(bool loading) { 333 void Shell::PlatformSetIsLoading(bool loading) {
334 } 334 }
335 335
336 void Shell::PlatformCreateWindow(int width, int height) { 336 void Shell::PlatformCreateWindow(int width, int height) {
337 #if defined(OS_CHROMEOS)
338 window_widget_ =
339 views::Widget::CreateWindowWithContextAndBounds(
340 new ShellWindowDelegateView(this),
341 minimal_ash_->GetDefaultParent(NULL, NULL, gfx::Rect()),
342 gfx::Rect(0, 0, width, height));
343 #else
337 window_widget_ = 344 window_widget_ =
338 views::Widget::CreateWindowWithBounds(new ShellWindowDelegateView(this), 345 views::Widget::CreateWindowWithBounds(new ShellWindowDelegateView(this),
339 gfx::Rect(0, 0, width, height)); 346 gfx::Rect(0, 0, width, height));
347 #endif
348
340 window_ = window_widget_->GetNativeWindow(); 349 window_ = window_widget_->GetNativeWindow();
341 window_widget_->Show(); 350 window_widget_->Show();
342 } 351 }
343 352
344 void Shell::PlatformSetContents() { 353 void Shell::PlatformSetContents() {
345 ShellWindowDelegateView* delegate_view = 354 ShellWindowDelegateView* delegate_view =
346 static_cast<ShellWindowDelegateView*>(window_widget_->widget_delegate()); 355 static_cast<ShellWindowDelegateView*>(window_widget_->widget_delegate());
347 delegate_view->SetWebContents(web_contents_.get()); 356 delegate_view->SetWebContents(web_contents_.get());
348 } 357 }
349 358
350 void Shell::PlatformResizeSubViews() { 359 void Shell::PlatformResizeSubViews() {
351 } 360 }
352 361
353 void Shell::Close() { 362 void Shell::Close() {
354 window_widget_->Close(); 363 window_widget_->Close();
355 } 364 }
356 365
357 void Shell::PlatformSetTitle(const string16& title) { 366 void Shell::PlatformSetTitle(const string16& title) {
358 ShellWindowDelegateView* delegate_view = 367 ShellWindowDelegateView* delegate_view =
359 static_cast<ShellWindowDelegateView*>(window_widget_->widget_delegate()); 368 static_cast<ShellWindowDelegateView*>(window_widget_->widget_delegate());
360 delegate_view->SetWindowTitle(title); 369 delegate_view->SetWindowTitle(title);
361 window_widget_->UpdateWindowTitle(); 370 window_widget_->UpdateWindowTitle();
362 } 371 }
363 372
364 } // namespace content 373 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698