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

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

Issue 2207043002: SetDeviceScaleFactorForTest Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: SetDeviceScaleFactorForTest Created 4 years, 4 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
« no previous file with comments | « content/shell/browser/shell.h ('k') | ui/aura/demo/demo_main.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 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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 16 matching lines...) Expand all
27 #include "ui/views/controls/textfield/textfield_controller.h" 27 #include "ui/views/controls/textfield/textfield_controller.h"
28 #include "ui/views/controls/webview/webview.h" 28 #include "ui/views/controls/webview/webview.h"
29 #include "ui/views/layout/fill_layout.h" 29 #include "ui/views/layout/fill_layout.h"
30 #include "ui/views/layout/grid_layout.h" 30 #include "ui/views/layout/grid_layout.h"
31 #include "ui/views/test/desktop_test_views_delegate.h" 31 #include "ui/views/test/desktop_test_views_delegate.h"
32 #include "ui/views/view.h" 32 #include "ui/views/view.h"
33 #include "ui/views/widget/widget.h" 33 #include "ui/views/widget/widget.h"
34 #include "ui/views/widget/widget_delegate.h" 34 #include "ui/views/widget/widget_delegate.h"
35 35
36 #if defined(OS_CHROMEOS) 36 #if defined(OS_CHROMEOS)
37 #include "ui/aura/test/test_screen.h"
38 #include "ui/wm/test/wm_test_helper.h" 37 #include "ui/wm/test/wm_test_helper.h"
39 #else // !defined(OS_CHROMEOS) 38 #else // !defined(OS_CHROMEOS)
40 #include "ui/views/widget/desktop_aura/desktop_screen.h" 39 #include "ui/views/widget/desktop_aura/desktop_screen.h"
41 #endif 40 #endif
42 41
43 #if defined(OS_WIN) 42 #if defined(OS_WIN)
44 #include <fcntl.h> 43 #include <fcntl.h>
45 #include <io.h> 44 #include <io.h>
46 #endif 45 #endif
47 46
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 // Contents view contains the web contents view 302 // Contents view contains the web contents view
304 View* contents_view_; 303 View* contents_view_;
305 views::WebView* web_view_; 304 views::WebView* web_view_;
306 305
307 DISALLOW_COPY_AND_ASSIGN(ShellWindowDelegateView); 306 DISALLOW_COPY_AND_ASSIGN(ShellWindowDelegateView);
308 }; 307 };
309 308
310 } // namespace 309 } // namespace
311 310
312 #if defined(OS_CHROMEOS) 311 #if defined(OS_CHROMEOS)
313 wm::WMTestHelper* Shell::wm_test_helper_ = NULL; 312 wm::WMTestHelper* wm_test_helper_ = NULL;
314 display::Screen* Shell::test_screen_ = NULL;
315 #endif 313 #endif
316 views::ViewsDelegate* Shell::views_delegate_ = NULL; 314 views::ViewsDelegate* views_delegate_ = NULL;
317 315
318 // static 316 // static
319 void Shell::PlatformInitialize(const gfx::Size& default_window_size) { 317 void Shell::PlatformInitialize(const gfx::Size& default_window_size) {
320 #if defined(OS_WIN) 318 #if defined(OS_WIN)
321 _setmode(_fileno(stdout), _O_BINARY); 319 _setmode(_fileno(stdout), _O_BINARY);
322 _setmode(_fileno(stderr), _O_BINARY); 320 _setmode(_fileno(stderr), _O_BINARY);
323 #endif 321 #endif
324 #if defined(OS_CHROMEOS) 322 #if defined(OS_CHROMEOS)
325 test_screen_ = aura::TestScreen::Create(gfx::Size());
326 display::Screen::SetScreenInstance(test_screen_);
327 wm_test_helper_ = new wm::WMTestHelper(default_window_size, 323 wm_test_helper_ = new wm::WMTestHelper(default_window_size,
328 GetContextFactory()); 324 GetContextFactory());
329 #else 325 #else
330 display::Screen::SetScreenInstance(views::CreateDesktopScreen()); 326 display::Screen::SetScreenInstance(views::CreateDesktopScreen());
331 #endif 327 #endif
332 views_delegate_ = new views::DesktopTestViewsDelegate(); 328 views_delegate_ = new views::DesktopTestViewsDelegate();
333 } 329 }
334 330
335 void Shell::PlatformExit() { 331 void Shell::PlatformExit() {
336 #if defined(OS_CHROMEOS) 332 #if defined(OS_CHROMEOS)
337 delete wm_test_helper_; 333 delete wm_test_helper_;
338 wm_test_helper_ = NULL; 334 wm_test_helper_ = NULL;
339
340 delete test_screen_;
341 test_screen_ = NULL;
342 #endif 335 #endif
343 delete views_delegate_; 336 delete views_delegate_;
344 views_delegate_ = NULL; 337 views_delegate_ = NULL;
345 delete platform_; 338 delete platform_;
346 platform_ = NULL; 339 platform_ = NULL;
347 } 340 }
348 341
349 void Shell::PlatformCleanUp() { 342 void Shell::PlatformCleanUp() {
350 } 343 }
351 344
(...skipping 27 matching lines...) Expand all
379 372
380 void Shell::PlatformCreateWindow(int width, int height) { 373 void Shell::PlatformCreateWindow(int width, int height) {
381 if (headless_) { 374 if (headless_) {
382 content_size_ = gfx::Size(width, height); 375 content_size_ = gfx::Size(width, height);
383 if (!platform_) 376 if (!platform_)
384 platform_ = new ShellPlatformDataAura(content_size_); 377 platform_ = new ShellPlatformDataAura(content_size_);
385 else 378 else
386 platform_->ResizeWindow(content_size_); 379 platform_->ResizeWindow(content_size_);
387 return; 380 return;
388 } 381 }
389 #if defined(OS_CHROMEOS)
390 window_widget_ = views::Widget::CreateWindowWithContextAndBounds(
391 new ShellWindowDelegateView(this),
392 wm_test_helper_->GetDefaultParent(NULL, NULL, gfx::Rect()),
393 gfx::Rect(0, 0, width, height));
394 #else
395 window_widget_ = new views::Widget; 382 window_widget_ = new views::Widget;
396 views::Widget::InitParams params; 383 views::Widget::InitParams params;
397 params.bounds = gfx::Rect(0, 0, width, height); 384 params.bounds = gfx::Rect(0, 0, width, height);
398 params.delegate = new ShellWindowDelegateView(this); 385 params.delegate = new ShellWindowDelegateView(this);
399 params.wm_class_class = "chromium-content_shell"; 386 params.wm_class_class = "chromium-content_shell";
400 params.wm_class_name = params.wm_class_class; 387 params.wm_class_name = params.wm_class_class;
388 #if defined(OS_CHROMEOS)
389 params.context = wm_test_helper_->host()->window();
390 #endif
401 window_widget_->Init(params); 391 window_widget_->Init(params);
402 #endif
403 392
404 content_size_ = gfx::Size(width, height); 393 content_size_ = gfx::Size(width, height);
405 394
406 window_ = window_widget_->GetNativeWindow(); 395 window_ = window_widget_->GetNativeWindow();
407 // Call ShowRootWindow on RootWindow created by WMTestHelper without 396 // Call ShowRootWindow on RootWindow created by WMTestHelper without
408 // which XWindow owned by RootWindow doesn't get mapped. 397 // which XWindow owned by RootWindow doesn't get mapped.
409 window_->GetHost()->Show(); 398 window_->GetHost()->Show();
410 window_widget_->Show(); 399 window_widget_->Show();
411 } 400 }
412 401
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 void Shell::PlatformSetTitle(const base::string16& title) { 433 void Shell::PlatformSetTitle(const base::string16& title) {
445 if (headless_) 434 if (headless_)
446 return; 435 return;
447 ShellWindowDelegateView* delegate_view = 436 ShellWindowDelegateView* delegate_view =
448 static_cast<ShellWindowDelegateView*>(window_widget_->widget_delegate()); 437 static_cast<ShellWindowDelegateView*>(window_widget_->widget_delegate());
449 delegate_view->SetWindowTitle(title); 438 delegate_view->SetWindowTitle(title);
450 window_widget_->UpdateWindowTitle(); 439 window_widget_->UpdateWindowTitle();
451 } 440 }
452 441
453 } // namespace content 442 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/browser/shell.h ('k') | ui/aura/demo/demo_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698