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

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

Issue 658383003: Componentize Constrained Window Views (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: gn Created 6 years, 2 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/views/chrome_constrained_window_views_client.h"
6
7 #include "chrome/browser/ui/browser_finder.h"
8 #include "components/constrained_window/constrained_window_views_client.h"
msw 2014/10/22 21:32:43 nit: not needed if included by the header.
oshima 2014/10/22 22:39:08 Done.
9 #include "components/web_modal/web_contents_modal_dialog_host.h"
10 #include "extensions/browser/guest_view/guest_view_base.h"
11
12 namespace {
13
14 class ChromeConstrainedWindowViewsClient
15 : public ConstrainedWindowViewsClient {
16 public:
17 ChromeConstrainedWindowViewsClient() {}
18 virtual ~ChromeConstrainedWindowViewsClient() {}
msw 2014/10/22 21:32:43 nit: virtual -> override (or final?) here and belo
oshima 2014/10/22 22:39:08 Oh, i didn't know about it. done.
19
20 private:
21 // ConstrainedWindowViewsClient:
22 virtual content::WebContents* GetEmbedderWebContents(
23 content::WebContents* initiator_web_contents) override {
24 extensions::GuestViewBase* guest_view =
25 extensions::GuestViewBase::FromWebContents(initiator_web_contents);
26 return guest_view && guest_view->embedder_web_contents() ?
27 guest_view->embedder_web_contents() : initiator_web_contents;
28 }
29 virtual web_modal::ModalDialogHost* GetModalDialogHost(
30 gfx::NativeWindow parent) override {
31 // Get the browser dialog management and hosting components from |parent|.
32 Browser* browser = chrome::FindBrowserWithWindow(parent);
33 if (browser) {
msw 2014/10/22 21:32:43 nit: return browser ? browser->GetWebContentsModal
oshima 2014/10/22 22:39:08 GetWebContentsModalDialogHost is private on Browse
msw 2014/10/23 18:49:05 Ahhhh, got it! This is fine as-is.
34 ChromeWebModalDialogManagerDelegate* manager = browser;
35 return manager->GetWebContentsModalDialogHost();
36 }
37 return NULL;
38 }
39
40 DISALLOW_COPY_AND_ASSIGN(ChromeConstrainedWindowViewsClient);
41 };
42
43 } // namespace
44
45 scoped_ptr<ConstrainedWindowViewsClient>
46 CreateChromeConstrainedWindowViewsClient() {
47 return make_scoped_ptr(new ChromeConstrainedWindowViewsClient);
48 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698