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

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

Issue 2669563003: Fix rare crash in WebstoreInlineInstaller::CheckInlineInstallPermitted. (Closed)
Patch Set: Move check to CheckRequestorAlive. Created 3 years, 10 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 (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 "chrome/browser/extensions/webstore_inline_installer.h" 5 #include "chrome/browser/extensions/webstore_inline_installer.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 base::JSONWriter::Write(dictionary, &json); 131 base::JSONWriter::Write(dictionary, &json);
132 return json; 132 return json;
133 } 133 }
134 } 134 }
135 135
136 return std::string(); 136 return std::string();
137 } 137 }
138 138
139 bool WebstoreInlineInstaller::CheckRequestorAlive() const { 139 bool WebstoreInlineInstaller::CheckRequestorAlive() const {
140 // The frame or tab may have gone away - cancel installation in that case. 140 // The frame or tab may have gone away - cancel installation in that case.
141 return host_ != nullptr && web_contents() != nullptr; 141 return host_ != nullptr && web_contents() != nullptr &&
142 chrome::FindBrowserWithWebContents(web_contents()) != nullptr;
142 } 143 }
143 144
144 const GURL& WebstoreInlineInstaller::GetRequestorURL() const { 145 const GURL& WebstoreInlineInstaller::GetRequestorURL() const {
145 return requestor_url_; 146 return requestor_url_;
146 } 147 }
147 148
148 std::unique_ptr<ExtensionInstallPrompt::Prompt> 149 std::unique_ptr<ExtensionInstallPrompt::Prompt>
149 WebstoreInlineInstaller::CreateInstallPrompt() const { 150 WebstoreInlineInstaller::CreateInstallPrompt() const {
150 std::unique_ptr<ExtensionInstallPrompt::Prompt> prompt( 151 std::unique_ptr<ExtensionInstallPrompt::Prompt> prompt(
151 new ExtensionInstallPrompt::Prompt( 152 new ExtensionInstallPrompt::Prompt(
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 DLOG(WARNING) << "Could not parse " << verified_site_pattern_spec << 287 DLOG(WARNING) << "Could not parse " << verified_site_pattern_spec <<
287 " as URL pattern " << parse_result; 288 " as URL pattern " << parse_result;
288 return false; 289 return false;
289 } 290 }
290 verified_site_pattern.SetScheme("*"); 291 verified_site_pattern.SetScheme("*");
291 292
292 return verified_site_pattern.MatchesURL(requestor_url); 293 return verified_site_pattern.MatchesURL(requestor_url);
293 } 294 }
294 295
295 } // namespace extensions 296 } // namespace extensions
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