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

Unified Diff: ash/shell/toplevel_window.cc

Issue 11795004: Continue threading context through unit tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/screen_ash_unittest.cc ('k') | ash/shell/window_type_launcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/shell/toplevel_window.cc
diff --git a/ash/shell/toplevel_window.cc b/ash/shell/toplevel_window.cc
index cb5f301c0361ade3340154afbb85d3d4e40518c9..2a104bbeac8c58705227269ab8b11b952e7ea5ba 100644
--- a/ash/shell/toplevel_window.cc
+++ b/ash/shell/toplevel_window.cc
@@ -4,8 +4,12 @@
#include "ash/shell/toplevel_window.h"
+#include "ash/display/display_controller.h"
+#include "ash/display/display_manager.h"
+#include "ash/shell.h"
#include "ash/wm/property_util.h"
#include "base/utf_string_conversions.h"
+#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
#include "ui/gfx/canvas.h"
#include "ui/views/widget/widget.h"
@@ -24,9 +28,14 @@ void ToplevelWindow::CreateToplevelWindow(const CreateParams& params) {
static int count = 0;
int x = count == 0 ? 150 : 750;
count = (count + 1) % 2;
- views::Widget* widget =
- views::Widget::CreateWindowWithBounds(new ToplevelWindow(params),
- gfx::Rect(x, 150, 300, 300));
+
+ gfx::Rect bounds(x, 150, 300, 300);
+ gfx::Display display =
+ ash::Shell::GetInstance()->display_manager()->GetDisplayMatching(bounds);
+ aura::RootWindow* root = ash::Shell::GetInstance()->display_controller()->
+ GetRootWindowForDisplayId(display.id());
+ views::Widget* widget = views::Widget::CreateWindowWithContextAndBounds(
+ new ToplevelWindow(params), root, bounds);
widget->GetNativeView()->SetName("Examples:ToplevelWindow");
if (params.persist_across_all_workspaces) {
SetPersistsAcrossAllWorkspaces(
« no previous file with comments | « ash/screen_ash_unittest.cc ('k') | ash/shell/window_type_launcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698