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

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

Issue 2179923002: Add a JavaScript dialog tab helper. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment Created 4 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
« no previous file with comments | « chrome/browser/devtools/devtools_window.cc ('k') | chrome/browser/ui/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 DISALLOW_COPY_AND_ASSIGN(DialogClient); 157 DISALLOW_COPY_AND_ASSIGN(DialogClient);
158 }; 158 };
159 159
160 DialogHelper::DialogHelper(content::WebContents* web_contents) 160 DialogHelper::DialogHelper(content::WebContents* web_contents)
161 : dialog_count_(0), 161 : dialog_count_(0),
162 web_contents_(web_contents), 162 web_contents_(web_contents),
163 dialog_manager_(nullptr), 163 dialog_manager_(nullptr),
164 client_(nullptr) { 164 client_(nullptr) {
165 app_modal::JavaScriptDialogManager* dialog_manager_impl = 165 app_modal::JavaScriptDialogManager* dialog_manager_impl =
166 app_modal::JavaScriptDialogManager::GetInstance(); 166 app_modal::JavaScriptDialogManager::GetInstance();
167 client_ = new DialogClient(this);
168 dialog_manager_impl->SetExtensionsClient(base::WrapUnique(client_));
169
167 dialog_manager_ = 170 dialog_manager_ =
168 web_contents_->GetDelegate()->GetJavaScriptDialogManager(web_contents_); 171 web_contents_->GetDelegate()->GetJavaScriptDialogManager(web_contents_);
169 DCHECK_EQ(dialog_manager_impl, dialog_manager_);
170
171 client_ = new DialogClient(this);
172 dialog_manager_impl->SetExtensionsClient(base::WrapUnique(client_));
173 } 172 }
174 173
175 DialogHelper::~DialogHelper() { 174 DialogHelper::~DialogHelper() {
176 client_->set_helper(nullptr); 175 client_->set_helper(nullptr);
177 } 176 }
178 177
179 void DialogHelper::CloseDialogs() { 178 void DialogHelper::CloseDialogs() {
180 dialog_manager_->CancelActiveAndPendingDialogs(web_contents_); 179 dialog_manager_->CancelActiveAndPendingDialogs(web_contents_);
181 } 180 }
182 181
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 ExtensionTestMessageListener iframe_loaded_listener("iframe loaded", false); 623 ExtensionTestMessageListener iframe_loaded_listener("iframe loaded", false);
625 ExtensionTestMessageListener content_script_listener("script injected", 624 ExtensionTestMessageListener content_script_listener("script injected",
626 false); 625 false);
627 LoadExtension(data_dir.AppendASCII("script_a_com")); 626 LoadExtension(data_dir.AppendASCII("script_a_com"));
628 LoadExtension(data_dir.AppendASCII("background_page_iframe")); 627 LoadExtension(data_dir.AppendASCII("background_page_iframe"));
629 iframe_loaded_listener.WaitUntilSatisfied(); 628 iframe_loaded_listener.WaitUntilSatisfied();
630 EXPECT_FALSE(content_script_listener.was_satisfied()); 629 EXPECT_FALSE(content_script_listener.was_satisfied());
631 } 630 }
632 631
633 } // namespace extensions 632 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/devtools/devtools_window.cc ('k') | chrome/browser/ui/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698