| 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" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 active_web_contents->GetOpener() == dialog_host) { | 27 active_web_contents->GetOpener() == dialog_host) { |
| 28 // It's indeed a popup from the dialog opening WebContents. Store it, so | 28 // It's indeed a popup from the dialog opening WebContents. Store it, so |
| 29 // we can focus it later. | 29 // we can focus it later. |
| 30 popup_ = active_web_contents; | 30 popup_ = active_web_contents; |
| 31 Observe(popup_); | 31 Observe(popup_); |
| 32 } | 32 } |
| 33 } | 33 } |
| 34 } | 34 } |
| 35 | 35 |
| 36 AppModalDialogHelper::~AppModalDialogHelper() { | 36 AppModalDialogHelper::~AppModalDialogHelper() { |
| 37 // TODO(johnme): Can we sometimes be certain this was for a user gesture? |
| 37 if (popup_) | 38 if (popup_) |
| 38 popup_->GetDelegate()->ActivateContents(popup_); | 39 popup_->GetDelegate()->ActivateContents(popup_, false /* user_gesture */); |
| 39 } | 40 } |
| 40 | 41 |
| 41 void AppModalDialogHelper::WebContentsDestroyed() { | 42 void AppModalDialogHelper::WebContentsDestroyed() { |
| 42 popup_ = nullptr; | 43 popup_ = nullptr; |
| 43 } | 44 } |
| OLD | NEW |