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

Side by Side Diff: chrome/browser/ui/views/extensions/native_app_window_views.cc

Issue 13588007: Implement WebContentsModalDialogManagerDelegate for ShellWindow (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add OVERRIDEs Created 7 years, 8 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 "chrome/browser/ui/views/extensions/native_app_window_views.h" 5 #include "chrome/browser/ui/views/extensions/native_app_window_views.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/threading/sequenced_worker_pool.h" 10 #include "base/threading/sequenced_worker_pool.h"
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 // the specified amount of space to fit the window controls in, and return a 376 // the specified amount of space to fit the window controls in, and return a
377 // number larger than the real frame insets. Most window controls are smaller 377 // number larger than the real frame insets. Most window controls are smaller
378 // than 1000x1000px, so this should be big enough. 378 // than 1000x1000px, so this should be big enough.
379 gfx::Rect client_bounds = gfx::Rect(1000, 1000); 379 gfx::Rect client_bounds = gfx::Rect(1000, 1000);
380 gfx::Rect window_bounds = 380 gfx::Rect window_bounds =
381 window_->non_client_view()->GetWindowBoundsForClientBounds( 381 window_->non_client_view()->GetWindowBoundsForClientBounds(
382 client_bounds); 382 client_bounds);
383 return window_bounds.InsetsFrom(client_bounds); 383 return window_bounds.InsetsFrom(client_bounds);
384 } 384 }
385 385
386 gfx::Point NativeAppWindowViews::GetDialogPosition(const gfx::Size& size) {
387 gfx::Size shell_window_size = window_->GetWindowBoundsInScreen().size();
388 return gfx::Point(shell_window_size.width() / 2 - size.width() / 2,
389 shell_window_size.height() / 2 - size.height() / 2);
390 }
391
392 void NativeAppWindowViews::AddObserver(
393 WebContentsModalDialogHostObserver* observer) {
394 observer_list_.AddObserver(observer);
395 }
396 void NativeAppWindowViews::RemoveObserver(
397 WebContentsModalDialogHostObserver* observer) {
398 observer_list_.RemoveObserver(observer);
399 }
400
386 // Private method. TODO(stevenjb): Move this below InitializePanelWindow() 401 // Private method. TODO(stevenjb): Move this below InitializePanelWindow()
387 // to match declaration order. 402 // to match declaration order.
388 void NativeAppWindowViews::OnViewWasResized() { 403 void NativeAppWindowViews::OnViewWasResized() {
389 // TODO(jeremya): this doesn't seem like a terribly elegant way to keep the 404 // TODO(jeremya): this doesn't seem like a terribly elegant way to keep the
390 // window shape in sync. 405 // window shape in sync.
391 #if defined(OS_WIN) && !defined(USE_AURA) 406 #if defined(OS_WIN) && !defined(USE_AURA)
392 // Set the window shape of the RWHV. 407 // Set the window shape of the RWHV.
393 DCHECK(window_); 408 DCHECK(window_);
394 DCHECK(web_view_); 409 DCHECK(web_view_);
395 gfx::Size sz = web_view_->size(); 410 gfx::Size sz = web_view_->size();
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 rgn->op(0, 0, kResizeInsideBoundsSize, height, SkRegion::kUnion_Op); 444 rgn->op(0, 0, kResizeInsideBoundsSize, height, SkRegion::kUnion_Op);
430 rgn->op(width - kResizeInsideBoundsSize, 0, width, height, 445 rgn->op(width - kResizeInsideBoundsSize, 0, width, height,
431 SkRegion::kUnion_Op); 446 SkRegion::kUnion_Op);
432 rgn->op(0, height - kResizeInsideBoundsSize, width, height, 447 rgn->op(0, height - kResizeInsideBoundsSize, width, height,
433 SkRegion::kUnion_Op); 448 SkRegion::kUnion_Op);
434 } 449 }
435 } 450 }
436 if (web_contents()->GetRenderViewHost()->GetView()) 451 if (web_contents()->GetRenderViewHost()->GetView())
437 web_contents()->GetRenderViewHost()->GetView()->SetClickthroughRegion(rgn); 452 web_contents()->GetRenderViewHost()->GetView()->SetClickthroughRegion(rgn);
438 #endif 453 #endif
454
455 FOR_EACH_OBSERVER(WebContentsModalDialogHostObserver,
456 observer_list_,
457 OnPositionRequiresUpdate());
439 } 458 }
440 459
441 // WidgetDelegate implementation. 460 // WidgetDelegate implementation.
442 461
443 void NativeAppWindowViews::OnWidgetMove() { 462 void NativeAppWindowViews::OnWidgetMove() {
444 shell_window_->OnNativeWindowChanged(); 463 shell_window_->OnNativeWindowChanged();
445 } 464 }
446 465
447 views::View* NativeAppWindowViews::GetInitiallyFocusedView() { 466 views::View* NativeAppWindowViews::GetInitiallyFocusedView() {
448 return web_view_; 467 return web_view_;
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 } 695 }
677 696
678 //------------------------------------------------------------------------------ 697 //------------------------------------------------------------------------------
679 // NativeAppWindow::Create 698 // NativeAppWindow::Create
680 699
681 // static 700 // static
682 NativeAppWindow* NativeAppWindow::Create( 701 NativeAppWindow* NativeAppWindow::Create(
683 ShellWindow* shell_window, const ShellWindow::CreateParams& params) { 702 ShellWindow* shell_window, const ShellWindow::CreateParams& params) {
684 return new NativeAppWindowViews(shell_window, params); 703 return new NativeAppWindowViews(shell_window, params);
685 } 704 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698