| OLD | NEW |
| 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" |
| 11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 #include "chrome/browser/extensions/webstore_data_fetcher.h" | 12 #include "chrome/browser/extensions/webstore_data_fetcher.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/ui/browser_finder.h" | 14 #include "chrome/browser/ui/browser_finder.h" |
| 15 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" | 15 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" |
| 16 #include "content/public/browser/navigation_details.h" | |
| 17 #include "content/public/browser/navigation_entry.h" | 16 #include "content/public/browser/navigation_entry.h" |
| 17 #include "content/public/browser/navigation_handle.h" |
| 18 #include "content/public/browser/web_contents.h" | 18 #include "content/public/browser/web_contents.h" |
| 19 | 19 |
| 20 using content::WebContents; | 20 using content::WebContents; |
| 21 | 21 |
| 22 namespace extensions { | 22 namespace extensions { |
| 23 | 23 |
| 24 const char kInvalidWebstoreResponseError[] = | 24 const char kInvalidWebstoreResponseError[] = |
| 25 "Invalid Chrome Web Store response."; | 25 "Invalid Chrome Web Store response."; |
| 26 const char kNoVerifiedSitesError[] = | 26 const char kNoVerifiedSitesError[] = |
| 27 "Inline installs can only be initiated for Chrome Web Store items that " | 27 "Inline installs can only be initiated for Chrome Web Store items that " |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 bool WebstoreInlineInstaller::CheckRequestorPermitted( | 222 bool WebstoreInlineInstaller::CheckRequestorPermitted( |
| 223 const base::DictionaryValue& webstore_data, | 223 const base::DictionaryValue& webstore_data, |
| 224 std::string* error) const { | 224 std::string* error) const { |
| 225 return IsRequestorPermitted(webstore_data, requestor_url_, error); | 225 return IsRequestorPermitted(webstore_data, requestor_url_, error); |
| 226 } | 226 } |
| 227 | 227 |
| 228 // | 228 // |
| 229 // Private implementation. | 229 // Private implementation. |
| 230 // | 230 // |
| 231 | 231 |
| 232 void WebstoreInlineInstaller::DidNavigateAnyFrame( | 232 void WebstoreInlineInstaller::DidFinishNavigation( |
| 233 content::RenderFrameHost* render_frame_host, | 233 content::NavigationHandle* navigation_handle) { |
| 234 const content::LoadCommittedDetails& details, | 234 if (navigation_handle->HasCommitted() && |
| 235 const content::FrameNavigateParams& params) { | 235 !navigation_handle->IsSamePage() && |
| 236 if (!details.is_in_page && | 236 (navigation_handle->GetRenderFrameHost() == host_ || |
| 237 (render_frame_host == host_ || details.is_main_frame)) | 237 navigation_handle->IsInMainFrame())) { |
| 238 host_ = nullptr; | 238 host_ = nullptr; |
| 239 } |
| 239 } | 240 } |
| 240 | 241 |
| 241 void WebstoreInlineInstaller::WebContentsDestroyed() { | 242 void WebstoreInlineInstaller::WebContentsDestroyed() { |
| 242 AbortInstall(); | 243 AbortInstall(); |
| 243 } | 244 } |
| 244 | 245 |
| 245 // static | 246 // static |
| 246 bool WebstoreInlineInstaller::IsRequestorURLInVerifiedSite( | 247 bool WebstoreInlineInstaller::IsRequestorURLInVerifiedSite( |
| 247 const GURL& requestor_url, | 248 const GURL& requestor_url, |
| 248 const std::string& verified_site) { | 249 const std::string& verified_site) { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| OLD | NEW |