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

Side by Side Diff: chrome/browser/extensions/extension_host.cc

Issue 22903022: Limit constrained windows to the size of the parent view. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Missing OVERRIDE Created 7 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
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/extensions/extension_host.h" 5 #include "chrome/browser/extensions/extension_host.h"
6 6
7 #include <list> 7 #include <list>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/singleton.h" 10 #include "base/memory/singleton.h"
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 300
301 gfx::Point ExtensionHost::GetDialogPosition(const gfx::Size& size) { 301 gfx::Point ExtensionHost::GetDialogPosition(const gfx::Size& size) {
302 if (!GetVisibleWebContents()) 302 if (!GetVisibleWebContents())
303 return gfx::Point(); 303 return gfx::Point();
304 gfx::Rect bounds = GetVisibleWebContents()->GetView()->GetViewBounds(); 304 gfx::Rect bounds = GetVisibleWebContents()->GetView()->GetViewBounds();
305 return gfx::Point( 305 return gfx::Point(
306 std::max(0, (bounds.width() - size.width()) / 2), 306 std::max(0, (bounds.width() - size.width()) / 2),
307 std::max(0, (bounds.height() - size.height()) / 2)); 307 std::max(0, (bounds.height() - size.height()) / 2));
308 } 308 }
309 309
310 gfx::Size ExtensionHost::GetMaximumDialogSize() {
311 if (!GetVisibleWebContents())
312 return gfx::Size();
313 return GetVisibleWebContents()->GetView()->GetViewBounds().size();
314 }
315
310 void ExtensionHost::AddObserver( 316 void ExtensionHost::AddObserver(
311 web_modal::WebContentsModalDialogHostObserver* observer) { 317 web_modal::WebContentsModalDialogHostObserver* observer) {
312 } 318 }
313 319
314 void ExtensionHost::RemoveObserver( 320 void ExtensionHost::RemoveObserver(
315 web_modal::WebContentsModalDialogHostObserver* observer) { 321 web_modal::WebContentsModalDialogHostObserver* observer) {
316 } 322 }
317 #endif 323 #endif
318 324
319 void ExtensionHost::Observe(int type, 325 void ExtensionHost::Observe(int type,
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 675
670 void ExtensionHost::RequestMediaAccessPermission( 676 void ExtensionHost::RequestMediaAccessPermission(
671 content::WebContents* web_contents, 677 content::WebContents* web_contents,
672 const content::MediaStreamRequest& request, 678 const content::MediaStreamRequest& request,
673 const content::MediaResponseCallback& callback) { 679 const content::MediaResponseCallback& callback) {
674 MediaCaptureDevicesDispatcher::GetInstance()->ProcessMediaAccessRequest( 680 MediaCaptureDevicesDispatcher::GetInstance()->ProcessMediaAccessRequest(
675 web_contents, request, callback, extension()); 681 web_contents, request, callback, extension());
676 } 682 }
677 683
678 } // namespace extensions 684 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698