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

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

Issue 184903003: Window ownership -> WindowTreeHost (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 9 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/render_widget_host_view.h" 9 #include "content/public/browser/render_widget_host_view.h"
10 #include "content/public/browser/web_contents.h" 10 #include "content/public/browser/web_contents.h"
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 Layout(); 143 Layout();
144 144
145 // Resize the widget, keeping the same origin. 145 // Resize the widget, keeping the same origin.
146 gfx::Rect bounds = GetWidget()->GetWindowBoundsInScreen(); 146 gfx::Rect bounds = GetWidget()->GetWindowBoundsInScreen();
147 bounds.set_size(GetWidget()->GetRootView()->GetPreferredSize()); 147 bounds.set_size(GetWidget()->GetRootView()->GetPreferredSize());
148 GetWidget()->SetBounds(bounds); 148 GetWidget()->SetBounds(bounds);
149 149
150 // Resizing a widget on chromeos doesn't automatically resize the root, need 150 // Resizing a widget on chromeos doesn't automatically resize the root, need
151 // to explicitly do that. 151 // to explicitly do that.
152 #if defined(OS_CHROMEOS) 152 #if defined(OS_CHROMEOS)
153 GetWidget()->GetNativeWindow()->GetDispatcher()->host()->SetBounds(bounds); 153 GetWidget()->GetNativeWindow()->GetHost()->SetBounds(bounds);
154 #endif 154 #endif
155 } 155 }
156 156
157 void SetWindowTitle(const base::string16& title) { title_ = title; } 157 void SetWindowTitle(const base::string16& title) { title_ = title; }
158 void EnableUIControl(UIControl control, bool is_enabled) { 158 void EnableUIControl(UIControl control, bool is_enabled) {
159 if (control == BACK_BUTTON) { 159 if (control == BACK_BUTTON) {
160 back_button_->SetState(is_enabled ? views::CustomButton::STATE_NORMAL 160 back_button_->SetState(is_enabled ? views::CustomButton::STATE_NORMAL
161 : views::CustomButton::STATE_DISABLED); 161 : views::CustomButton::STATE_DISABLED);
162 } else if (control == FORWARD_BUTTON) { 162 } else if (control == FORWARD_BUTTON) {
163 forward_button_->SetState(is_enabled ? views::CustomButton::STATE_NORMAL 163 forward_button_->SetState(is_enabled ? views::CustomButton::STATE_NORMAL
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 params.top_level = true; 497 params.top_level = true;
498 params.remove_standard_frame = true; 498 params.remove_standard_frame = true;
499 window_widget_->Init(params); 499 window_widget_->Init(params);
500 #endif 500 #endif
501 501
502 content_size_ = gfx::Size(width, height); 502 content_size_ = gfx::Size(width, height);
503 503
504 window_ = window_widget_->GetNativeWindow(); 504 window_ = window_widget_->GetNativeWindow();
505 // Call ShowRootWindow on RootWindow created by WMTestHelper without 505 // Call ShowRootWindow on RootWindow created by WMTestHelper without
506 // which XWindow owned by RootWindow doesn't get mapped. 506 // which XWindow owned by RootWindow doesn't get mapped.
507 window_->GetDispatcher()->host()->Show(); 507 window_->GetHost()->Show();
508 window_widget_->Show(); 508 window_widget_->Show();
509 } 509 }
510 510
511 void Shell::PlatformSetContents() { 511 void Shell::PlatformSetContents() {
512 if (headless_) { 512 if (headless_) {
513 CHECK(platform_); 513 CHECK(platform_);
514 aura::Window* content = web_contents_->GetView()->GetNativeView(); 514 aura::Window* content = web_contents_->GetView()->GetNativeView();
515 aura::Window* parent = platform_->dispatcher()->window(); 515 aura::Window* parent = platform_->dispatcher()->window();
516 if (!parent->Contains(content)) { 516 if (!parent->Contains(content)) {
517 parent->AddChild(content); 517 parent->AddChild(content);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 560
561 void Shell::PlatformWebContentsFocused(WebContents* contents) { 561 void Shell::PlatformWebContentsFocused(WebContents* contents) {
562 if (headless_) 562 if (headless_)
563 return; 563 return;
564 ShellWindowDelegateView* delegate_view = 564 ShellWindowDelegateView* delegate_view =
565 static_cast<ShellWindowDelegateView*>(window_widget_->widget_delegate()); 565 static_cast<ShellWindowDelegateView*>(window_widget_->widget_delegate());
566 delegate_view->OnWebContentsFocused(contents); 566 delegate_view->OnWebContentsFocused(contents);
567 } 567 }
568 568
569 } // namespace content 569 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/browser/shell_download_manager_delegate.cc ('k') | mojo/examples/launcher/launcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698