| OLD | NEW |
| 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 "chrome/browser/ui/views/extensions/shell_window_views.h" | 5 #include "chrome/browser/ui/views/extensions/shell_window_views.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/extensions/extension_host.h" | 8 #include "chrome/browser/extensions/extension_host.h" |
| 9 #include "chrome/common/extensions/draggable_region.h" | 9 #include "chrome/common/extensions/draggable_region.h" |
| 10 #include "chrome/common/extensions/extension.h" | 10 #include "chrome/common/extensions/extension.h" |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 #endif | 329 #endif |
| 330 OnViewWasResized(); | 330 OnViewWasResized(); |
| 331 | 331 |
| 332 window_->Show(); | 332 window_->Show(); |
| 333 } | 333 } |
| 334 | 334 |
| 335 views::View* ShellWindowViews::GetInitiallyFocusedView() { | 335 views::View* ShellWindowViews::GetInitiallyFocusedView() { |
| 336 return web_view_; | 336 return web_view_; |
| 337 } | 337 } |
| 338 | 338 |
| 339 bool ShellWindowViews::ShouldDescendIntoChildForEventHandling( |
| 340 gfx::NativeView child, |
| 341 const gfx::Point& location) { |
| 342 #if defined(USE_AURA) |
| 343 DCHECK_EQ(child, web_view_->web_contents()->GetView()->GetNativeView()); |
| 344 // Shell window should claim mouse events that fall within the draggable |
| 345 // region. |
| 346 return !draggable_region_.get() || |
| 347 !draggable_region_->contains(location.x(), location.y()); |
| 348 #else |
| 349 return true; |
| 350 #endif |
| 351 } |
| 352 |
| 339 void ShellWindowViews::OnFocus() { | 353 void ShellWindowViews::OnFocus() { |
| 340 web_view_->RequestFocus(); | 354 web_view_->RequestFocus(); |
| 341 } | 355 } |
| 342 | 356 |
| 343 void ShellWindowViews::ViewHierarchyChanged( | 357 void ShellWindowViews::ViewHierarchyChanged( |
| 344 bool is_add, views::View *parent, views::View *child) { | 358 bool is_add, views::View *parent, views::View *child) { |
| 345 if (is_add && child == this) { | 359 if (is_add && child == this) { |
| 346 web_view_ = new views::WebView(NULL); | 360 web_view_ = new views::WebView(NULL); |
| 347 AddChildView(web_view_); | 361 AddChildView(web_view_); |
| 348 web_view_->SetWebContents(web_contents()); | 362 web_view_->SetWebContents(web_contents()); |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 | 590 |
| 577 draggable_region_.reset(draggable_region); | 591 draggable_region_.reset(draggable_region); |
| 578 OnViewWasResized(); | 592 OnViewWasResized(); |
| 579 } | 593 } |
| 580 | 594 |
| 581 // static | 595 // static |
| 582 NativeShellWindow* NativeShellWindow::Create( | 596 NativeShellWindow* NativeShellWindow::Create( |
| 583 ShellWindow* shell_window, const ShellWindow::CreateParams& params) { | 597 ShellWindow* shell_window, const ShellWindow::CreateParams& params) { |
| 584 return new ShellWindowViews(shell_window, params); | 598 return new ShellWindowViews(shell_window, params); |
| 585 } | 599 } |
| OLD | NEW |