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

Side by Side Diff: content/browser/web_contents/web_contents_view_aura.cc

Issue 10905290: Keep a web dialog window centered over the content area (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Better. Created 8 years, 3 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 (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 "content/browser/web_contents/web_contents_view_aura.h" 5 #include "content/browser/web_contents/web_contents_view_aura.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "content/browser/renderer_host/dip_util.h" 8 #include "content/browser/renderer_host/dip_util.h"
9 #include "content/browser/renderer_host/render_view_host_factory.h" 9 #include "content/browser/renderer_host/render_view_host_factory.h"
10 #include "content/browser/web_contents/interstitial_page_impl.h" 10 #include "content/browser/web_contents/interstitial_page_impl.h"
11 #include "content/browser/web_contents/web_contents_impl.h" 11 #include "content/browser/web_contents/web_contents_impl.h"
12 #include "content/public/browser/render_view_host.h" 12 #include "content/public/browser/render_view_host.h"
13 #include "content/public/browser/render_widget_host.h" 13 #include "content/public/browser/render_widget_host.h"
14 #include "content/public/browser/render_widget_host_view.h" 14 #include "content/public/browser/render_widget_host_view.h"
15 #include "content/public/browser/web_contents_delegate.h" 15 #include "content/public/browser/web_contents_delegate.h"
16 #include "content/public/browser/web_contents_view_delegate.h" 16 #include "content/public/browser/web_contents_view_delegate.h"
17 #include "content/public/browser/web_drag_dest_delegate.h" 17 #include "content/public/browser/web_drag_dest_delegate.h"
18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
19 #include "ui/aura/client/aura_constants.h"
19 #include "ui/aura/client/drag_drop_client.h" 20 #include "ui/aura/client/drag_drop_client.h"
20 #include "ui/aura/client/drag_drop_delegate.h" 21 #include "ui/aura/client/drag_drop_delegate.h"
21 #include "ui/aura/root_window.h" 22 #include "ui/aura/root_window.h"
22 #include "ui/aura/window.h" 23 #include "ui/aura/window.h"
23 #include "ui/base/clipboard/custom_data_helper.h" 24 #include "ui/base/clipboard/custom_data_helper.h"
24 #include "ui/base/dragdrop/drag_drop_types.h" 25 #include "ui/base/dragdrop/drag_drop_types.h"
25 #include "ui/base/dragdrop/os_exchange_data.h" 26 #include "ui/base/dragdrop/os_exchange_data.h"
26 #include "ui/base/dragdrop/os_exchange_data_provider_aura.h" 27 #include "ui/base/dragdrop/os_exchange_data_provider_aura.h"
27 #include "ui/base/events/event.h" 28 #include "ui/base/events/event.h"
28 #include "ui/base/hit_test.h" 29 #include "ui/base/hit_test.h"
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 483
483 gfx::Size WebContentsViewAura::GetMinimumSize() const { 484 gfx::Size WebContentsViewAura::GetMinimumSize() const {
484 return gfx::Size(); 485 return gfx::Size();
485 } 486 }
486 487
487 void WebContentsViewAura::OnBoundsChanged(const gfx::Rect& old_bounds, 488 void WebContentsViewAura::OnBoundsChanged(const gfx::Rect& old_bounds,
488 const gfx::Rect& new_bounds) { 489 const gfx::Rect& new_bounds) {
489 SizeChangedCommon(new_bounds.size()); 490 SizeChangedCommon(new_bounds.size());
490 if (delegate_.get()) 491 if (delegate_.get())
491 delegate_->SizeChanged(new_bounds.size()); 492 delegate_->SizeChanged(new_bounds.size());
493
494 // Constrained web dialogs, need to be kept centered over our content area.
495 for (size_t i = 0; i < window_->children().size(); i++) {
496 if (window_->children()[i]->GetProperty(
497 aura::client::kConstrainedWindowKey)) {
498 gfx::Rect bounds = window_->children()[i]->bounds();
499 bounds.Offset((new_bounds.width() - old_bounds.width()) / 2,
500 (new_bounds.height() - old_bounds.height()) / 2);
501 window_->children()[i]->SetBounds(bounds);
502 }
503 }
492 } 504 }
493 505
494 void WebContentsViewAura::OnFocus(aura::Window* old_focused_window) { 506 void WebContentsViewAura::OnFocus(aura::Window* old_focused_window) {
495 } 507 }
496 508
497 void WebContentsViewAura::OnBlur() { 509 void WebContentsViewAura::OnBlur() {
498 } 510 }
499 511
500 gfx::NativeCursor WebContentsViewAura::GetCursor(const gfx::Point& point) { 512 gfx::NativeCursor WebContentsViewAura::GetCursor(const gfx::Point& point) {
501 return gfx::kNullCursor; 513 return gfx::kNullCursor;
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 OnDragEntered(event); 656 OnDragEntered(event);
645 657
646 web_contents_->GetRenderViewHost()->DragTargetDrop( 658 web_contents_->GetRenderViewHost()->DragTargetDrop(
647 event.location(), 659 event.location(),
648 gfx::Screen::GetCursorScreenPoint(), 660 gfx::Screen::GetCursorScreenPoint(),
649 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags())); 661 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags()));
650 if (drag_dest_delegate_) 662 if (drag_dest_delegate_)
651 drag_dest_delegate_->OnDrop(); 663 drag_dest_delegate_->OnDrop();
652 return current_drag_op_; 664 return current_drag_op_;
653 } 665 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/native_constrained_window_aura.cc ('k') | ui/aura/client/aura_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698