| OLD | NEW |
| 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/blocked_content/app_modal_dialog_helper.h" | 5 #include "chrome/browser/ui/blocked_content/app_modal_dialog_helper.h" |
| 6 | 6 |
| 7 #include "chrome/browser/ui/browser.h" | 7 #include "chrome/browser/ui/browser.h" |
| 8 #include "chrome/browser/ui/browser_finder.h" | 8 #include "chrome/browser/ui/browser_finder.h" |
| 9 #include "chrome/browser/ui/browser_list.h" | 9 #include "chrome/browser/ui/browser_list.h" |
| 10 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 10 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 11 #include "content/public/browser/web_contents.h" | 11 #include "content/public/browser/web_contents.h" |
| 12 #include "content/public/browser/web_contents_delegate.h" | 12 #include "content/public/browser/web_contents_delegate.h" |
| 13 #include "extensions/features/features.h" |
| 13 | 14 |
| 14 #if defined(ENABLE_EXTENSIONS) | 15 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 15 #include "components/guest_view/browser/guest_view_base.h" | 16 #include "components/guest_view/browser/guest_view_base.h" |
| 16 #endif | 17 #endif |
| 17 | 18 |
| 18 AppModalDialogHelper::AppModalDialogHelper(content::WebContents* dialog_host) | 19 AppModalDialogHelper::AppModalDialogHelper(content::WebContents* dialog_host) |
| 19 : popup_(nullptr) { | 20 : popup_(nullptr) { |
| 20 content::WebContents* actual_host = dialog_host; | 21 content::WebContents* actual_host = dialog_host; |
| 21 #if defined(ENABLE_EXTENSIONS) | 22 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 22 // If the dialog was triggered via an PDF, get the actual web contents that | 23 // If the dialog was triggered via an PDF, get the actual web contents that |
| 23 // embedds the PDF. | 24 // embedds the PDF. |
| 24 guest_view::GuestViewBase* guest = | 25 guest_view::GuestViewBase* guest = |
| 25 guest_view::GuestViewBase::FromWebContents(dialog_host); | 26 guest_view::GuestViewBase::FromWebContents(dialog_host); |
| 26 if (guest) | 27 if (guest) |
| 27 actual_host = guest->embedder_web_contents(); | 28 actual_host = guest->embedder_web_contents(); |
| 28 #endif | 29 #endif |
| 29 | 30 |
| 30 // If the WebContents that triggered this dialog is not currently focused, we | 31 // If the WebContents that triggered this dialog is not currently focused, we |
| 31 // want to store a potential popup here to restore it after the dialog was | 32 // want to store a potential popup here to restore it after the dialog was |
| (...skipping 13 matching lines...) Expand all Loading... |
| 45 } | 46 } |
| 46 | 47 |
| 47 AppModalDialogHelper::~AppModalDialogHelper() { | 48 AppModalDialogHelper::~AppModalDialogHelper() { |
| 48 if (popup_) | 49 if (popup_) |
| 49 popup_->GetDelegate()->ActivateContents(popup_); | 50 popup_->GetDelegate()->ActivateContents(popup_); |
| 50 } | 51 } |
| 51 | 52 |
| 52 void AppModalDialogHelper::WebContentsDestroyed() { | 53 void AppModalDialogHelper::WebContentsDestroyed() { |
| 53 popup_ = nullptr; | 54 popup_ = nullptr; |
| 54 } | 55 } |
| OLD | NEW |