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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/screen_ash_unittest.cc ('k') | ash/shell/window_type_launcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ash/shell/toplevel_window.h" 5 #include "ash/shell/toplevel_window.h"
6 6
7 #include "ash/display/display_controller.h"
8 #include "ash/display/display_manager.h"
9 #include "ash/shell.h"
7 #include "ash/wm/property_util.h" 10 #include "ash/wm/property_util.h"
8 #include "base/utf_string_conversions.h" 11 #include "base/utf_string_conversions.h"
12 #include "ui/aura/root_window.h"
9 #include "ui/aura/window.h" 13 #include "ui/aura/window.h"
10 #include "ui/gfx/canvas.h" 14 #include "ui/gfx/canvas.h"
11 #include "ui/views/widget/widget.h" 15 #include "ui/views/widget/widget.h"
12 16
13 namespace ash { 17 namespace ash {
14 namespace shell { 18 namespace shell {
15 19
16 ToplevelWindow::CreateParams::CreateParams() 20 ToplevelWindow::CreateParams::CreateParams()
17 : can_resize(false), 21 : can_resize(false),
18 can_maximize(false), 22 can_maximize(false),
19 persist_across_all_workspaces(false) { 23 persist_across_all_workspaces(false) {
20 } 24 }
21 25
22 // static 26 // static
23 void ToplevelWindow::CreateToplevelWindow(const CreateParams& params) { 27 void ToplevelWindow::CreateToplevelWindow(const CreateParams& params) {
24 static int count = 0; 28 static int count = 0;
25 int x = count == 0 ? 150 : 750; 29 int x = count == 0 ? 150 : 750;
26 count = (count + 1) % 2; 30 count = (count + 1) % 2;
27 views::Widget* widget = 31
28 views::Widget::CreateWindowWithBounds(new ToplevelWindow(params), 32 gfx::Rect bounds(x, 150, 300, 300);
29 gfx::Rect(x, 150, 300, 300)); 33 gfx::Display display =
34 ash::Shell::GetInstance()->display_manager()->GetDisplayMatching(bounds);
35 aura::RootWindow* root = ash::Shell::GetInstance()->display_controller()->
36 GetRootWindowForDisplayId(display.id());
37 views::Widget* widget = views::Widget::CreateWindowWithContextAndBounds(
38 new ToplevelWindow(params), root, bounds);
30 widget->GetNativeView()->SetName("Examples:ToplevelWindow"); 39 widget->GetNativeView()->SetName("Examples:ToplevelWindow");
31 if (params.persist_across_all_workspaces) { 40 if (params.persist_across_all_workspaces) {
32 SetPersistsAcrossAllWorkspaces( 41 SetPersistsAcrossAllWorkspaces(
33 widget->GetNativeView(), 42 widget->GetNativeView(),
34 WINDOW_PERSISTS_ACROSS_ALL_WORKSPACES_VALUE_YES); 43 WINDOW_PERSISTS_ACROSS_ALL_WORKSPACES_VALUE_YES);
35 } 44 }
36 widget->Show(); 45 widget->Show();
37 } 46 }
38 47
39 ToplevelWindow::ToplevelWindow(const CreateParams& params) : params_(params) { 48 ToplevelWindow::ToplevelWindow(const CreateParams& params) : params_(params) {
(...skipping 19 matching lines...) Expand all
59 bool ToplevelWindow::CanResize() const { 68 bool ToplevelWindow::CanResize() const {
60 return params_.can_resize; 69 return params_.can_resize;
61 } 70 }
62 71
63 bool ToplevelWindow::CanMaximize() const { 72 bool ToplevelWindow::CanMaximize() const {
64 return params_.can_maximize; 73 return params_.can_maximize;
65 } 74 }
66 75
67 } // namespace shell 76 } // namespace shell
68 } // namespace ash 77 } // namespace ash
OLDNEW
« 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