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

Side by Side Diff: content/shell/browser/shell_views.cc

Issue 344833004: aura: Make sure TestScreen objects are destroyed properly. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 6 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/browser/shell.h" 5 #include "content/shell/browser/shell.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "content/public/browser/context_factory.h" 9 #include "content/public/browser/context_factory.h"
10 #include "content/public/browser/render_widget_host_view.h" 10 #include "content/public/browser/render_widget_host_view.h"
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 View* contents_view_; 405 View* contents_view_;
406 views::WebView* web_view_; 406 views::WebView* web_view_;
407 407
408 DISALLOW_COPY_AND_ASSIGN(ShellWindowDelegateView); 408 DISALLOW_COPY_AND_ASSIGN(ShellWindowDelegateView);
409 }; 409 };
410 410
411 } // namespace 411 } // namespace
412 412
413 #if defined(OS_CHROMEOS) 413 #if defined(OS_CHROMEOS)
414 wm::WMTestHelper* Shell::wm_test_helper_ = NULL; 414 wm::WMTestHelper* Shell::wm_test_helper_ = NULL;
415 gfx::Screen* Shell::test_screen_ = NULL;
415 #endif 416 #endif
416 views::ViewsDelegate* Shell::views_delegate_ = NULL; 417 views::ViewsDelegate* Shell::views_delegate_ = NULL;
417 418
418 // static 419 // static
419 void Shell::PlatformInitialize(const gfx::Size& default_window_size) { 420 void Shell::PlatformInitialize(const gfx::Size& default_window_size) {
420 #if defined(OS_WIN) 421 #if defined(OS_WIN)
421 _setmode(_fileno(stdout), _O_BINARY); 422 _setmode(_fileno(stdout), _O_BINARY);
422 _setmode(_fileno(stderr), _O_BINARY); 423 _setmode(_fileno(stderr), _O_BINARY);
423 #endif 424 #endif
424 #if defined(OS_CHROMEOS) 425 #if defined(OS_CHROMEOS)
425 chromeos::DBusThreadManager::Initialize(); 426 chromeos::DBusThreadManager::Initialize();
426 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, 427 test_screen_ = aura::TestScreen::Create(gfx::Size());
427 aura::TestScreen::Create(gfx::Size())); 428 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen_);
428 wm_test_helper_ = new wm::WMTestHelper(default_window_size, 429 wm_test_helper_ = new wm::WMTestHelper(default_window_size,
429 GetContextFactory()); 430 GetContextFactory());
430 #else 431 #else
431 gfx::Screen::SetScreenInstance( 432 gfx::Screen::SetScreenInstance(
432 gfx::SCREEN_TYPE_NATIVE, views::CreateDesktopScreen()); 433 gfx::SCREEN_TYPE_NATIVE, views::CreateDesktopScreen());
433 #endif 434 #endif
434 views_delegate_ = new ShellViewsDelegateAura(); 435 views_delegate_ = new ShellViewsDelegateAura();
435 } 436 }
436 437
437 void Shell::PlatformExit() { 438 void Shell::PlatformExit() {
438 #if defined(OS_CHROMEOS) 439 #if defined(OS_CHROMEOS)
439 delete wm_test_helper_; 440 delete wm_test_helper_;
441 delete test_screen_;
440 #endif 442 #endif
441 delete views_delegate_; 443 delete views_delegate_;
442 views_delegate_ = NULL; 444 views_delegate_ = NULL;
443 delete platform_; 445 delete platform_;
444 platform_ = NULL; 446 platform_ = NULL;
445 #if defined(OS_CHROMEOS) 447 #if defined(OS_CHROMEOS)
446 chromeos::DBusThreadManager::Shutdown(); 448 chromeos::DBusThreadManager::Shutdown();
447 #endif 449 #endif
448 aura::Env::DeleteInstance(); 450 aura::Env::DeleteInstance();
449 } 451 }
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 565
564 void Shell::PlatformWebContentsFocused(WebContents* contents) { 566 void Shell::PlatformWebContentsFocused(WebContents* contents) {
565 if (headless_) 567 if (headless_)
566 return; 568 return;
567 ShellWindowDelegateView* delegate_view = 569 ShellWindowDelegateView* delegate_view =
568 static_cast<ShellWindowDelegateView*>(window_widget_->widget_delegate()); 570 static_cast<ShellWindowDelegateView*>(window_widget_->widget_delegate());
569 delegate_view->OnWebContentsFocused(contents); 571 delegate_view->OnWebContentsFocused(contents);
570 } 572 }
571 573
572 } // namespace content 574 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698