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

Side by Side Diff: chrome/browser/ui/views/chrome_constrained_window_views_client.cc

Issue 1012373002: Return the outermost embedder when returning the embedder web contents. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/chrome_constrained_window_views_client.h" 5 #include "chrome/browser/ui/views/chrome_constrained_window_views_client.h"
6 6
7 #include "chrome/browser/platform_util.h" 7 #include "chrome/browser/platform_util.h"
8 #include "chrome/browser/ui/browser_finder.h" 8 #include "chrome/browser/ui/browser_finder.h"
9 #include "components/web_modal/web_contents_modal_dialog_host.h" 9 #include "components/web_modal/web_contents_modal_dialog_host.h"
10 #include "extensions/browser/guest_view/guest_view_base.h" 10 #include "extensions/browser/guest_view/guest_view_base.h"
11 11
12 namespace { 12 namespace {
13 13
14 class ChromeConstrainedWindowViewsClient 14 class ChromeConstrainedWindowViewsClient
15 : public constrained_window::ConstrainedWindowViewsClient { 15 : public constrained_window::ConstrainedWindowViewsClient {
16 public: 16 public:
17 ChromeConstrainedWindowViewsClient() {} 17 ChromeConstrainedWindowViewsClient() {}
18 ~ChromeConstrainedWindowViewsClient() override {} 18 ~ChromeConstrainedWindowViewsClient() override {}
19 19
20 private: 20 private:
21 // ConstrainedWindowViewsClient: 21 // ConstrainedWindowViewsClient:
22 content::WebContents* GetEmbedderWebContents( 22 content::WebContents* GetEmbedderWebContents(
23 content::WebContents* initiator_web_contents) override { 23 content::WebContents* initiator_web_contents) override {
24 extensions::GuestViewBase* guest_view = 24 while (extensions::GuestViewBase* guest_view =
sky 2015/03/18 15:00:36 This is worth a comment.
Sam McNally 2015/03/18 22:40:57 Done.
25 extensions::GuestViewBase::FromWebContents(initiator_web_contents); 25 extensions::GuestViewBase::FromWebContents(
26 return guest_view && guest_view->embedder_web_contents() ? 26 initiator_web_contents)) {
27 guest_view->embedder_web_contents() : initiator_web_contents; 27 if (!guest_view->embedder_web_contents())
28 break;
29 initiator_web_contents = guest_view->embedder_web_contents();
30 }
31 return initiator_web_contents;
28 } 32 }
29 web_modal::ModalDialogHost* GetModalDialogHost( 33 web_modal::ModalDialogHost* GetModalDialogHost(
30 gfx::NativeWindow parent) override { 34 gfx::NativeWindow parent) override {
31 // Get the browser dialog management and hosting components from |parent|. 35 // Get the browser dialog management and hosting components from |parent|.
32 Browser* browser = chrome::FindBrowserWithWindow(parent); 36 Browser* browser = chrome::FindBrowserWithWindow(parent);
33 if (browser) { 37 if (browser) {
34 ChromeWebModalDialogManagerDelegate* manager = browser; 38 ChromeWebModalDialogManagerDelegate* manager = browser;
35 return manager->GetWebContentsModalDialogHost(); 39 return manager->GetWebContentsModalDialogHost();
36 } 40 }
37 return nullptr; 41 return nullptr;
38 } 42 }
39 gfx::NativeView GetDialogHostView(gfx::NativeWindow parent) override { 43 gfx::NativeView GetDialogHostView(gfx::NativeWindow parent) override {
40 return platform_util::GetViewForWindow(parent); 44 return platform_util::GetViewForWindow(parent);
41 } 45 }
42 46
43 DISALLOW_COPY_AND_ASSIGN(ChromeConstrainedWindowViewsClient); 47 DISALLOW_COPY_AND_ASSIGN(ChromeConstrainedWindowViewsClient);
44 }; 48 };
45 49
46 } // namespace 50 } // namespace
47 51
48 scoped_ptr<constrained_window::ConstrainedWindowViewsClient> 52 scoped_ptr<constrained_window::ConstrainedWindowViewsClient>
49 CreateChromeConstrainedWindowViewsClient() { 53 CreateChromeConstrainedWindowViewsClient() {
50 return make_scoped_ptr(new ChromeConstrainedWindowViewsClient); 54 return make_scoped_ptr(new ChromeConstrainedWindowViewsClient);
51 } 55 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698