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

Side by Side Diff: chrome/browser/chromeos/attestation/platform_verification_flow.cc

Issue 1726323002: Have Permission{Manager,Service} use Origin. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 8 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/chromeos/attestation/platform_verification_flow.h" 5 #include "chrome/browser/chromeos/attestation/platform_verification_flow.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 20 matching lines...) Expand all
31 #include "components/user_manager/user.h" 31 #include "components/user_manager/user.h"
32 #include "content/public/browser/browser_context.h" 32 #include "content/public/browser/browser_context.h"
33 #include "content/public/browser/browser_thread.h" 33 #include "content/public/browser/browser_thread.h"
34 #include "content/public/browser/render_process_host.h" 34 #include "content/public/browser/render_process_host.h"
35 #include "content/public/browser/render_view_host.h" 35 #include "content/public/browser/render_view_host.h"
36 #include "content/public/browser/user_metrics.h" 36 #include "content/public/browser/user_metrics.h"
37 #include "content/public/browser/web_contents.h" 37 #include "content/public/browser/web_contents.h"
38 #include "content/public/common/url_constants.h" 38 #include "content/public/common/url_constants.h"
39 #include "net/cert/pem_tokenizer.h" 39 #include "net/cert/pem_tokenizer.h"
40 #include "net/cert/x509_certificate.h" 40 #include "net/cert/x509_certificate.h"
41 #include "url/origin.h"
41 42
42 namespace { 43 namespace {
43 44
44 using chromeos::attestation::PlatformVerificationFlow; 45 using chromeos::attestation::PlatformVerificationFlow;
45 46
46 const int kTimeoutInSeconds = 8; 47 const int kTimeoutInSeconds = 8;
47 const char kAttestationResultHistogram[] = 48 const char kAttestationResultHistogram[] =
48 "ChromeOS.PlatformVerification.Result"; 49 "ChromeOS.PlatformVerification.Result";
49 const char kAttestationAvailableHistogram[] = 50 const char kAttestationAvailableHistogram[] =
50 "ChromeOS.PlatformVerification.Available"; 51 "ChromeOS.PlatformVerification.Available";
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 } 106 }
106 107
107 bool IsPermittedByUser(content::WebContents* web_contents) override { 108 bool IsPermittedByUser(content::WebContents* web_contents) override {
108 ProtectedMediaIdentifierPermissionContext* permission_context = 109 ProtectedMediaIdentifierPermissionContext* permission_context =
109 ProtectedMediaIdentifierPermissionContextFactory::GetForProfile( 110 ProtectedMediaIdentifierPermissionContextFactory::GetForProfile(
110 Profile::FromBrowserContext(web_contents->GetBrowserContext())); 111 Profile::FromBrowserContext(web_contents->GetBrowserContext()));
111 112
112 // TODO(xhwang): Using delegate_->GetURL() here is not right. The platform 113 // TODO(xhwang): Using delegate_->GetURL() here is not right. The platform
113 // verification may be requested by a frame from a different origin. This 114 // verification may be requested by a frame from a different origin. This
114 // will be solved when http://crbug.com/454847 is fixed. 115 // will be solved when http://crbug.com/454847 is fixed.
115 const GURL& requesting_origin = GetURL(web_contents).GetOrigin(); 116 const url::Origin requesting_origin(GetURL(web_contents));
116 117 const url::Origin embedding_origin(web_contents->GetLastCommittedURL());
117 GURL embedding_origin = web_contents->GetLastCommittedURL().GetOrigin();
118
119 ContentSetting content_setting = permission_context->GetPermissionStatus( 118 ContentSetting content_setting = permission_context->GetPermissionStatus(
120 requesting_origin, embedding_origin); 119 requesting_origin, embedding_origin);
121 120
122 return content_setting == CONTENT_SETTING_ALLOW; 121 return content_setting == CONTENT_SETTING_ALLOW;
123 } 122 }
124 123
125 bool IsInSupportedMode(content::WebContents* web_contents) override { 124 bool IsInSupportedMode(content::WebContents* web_contents) override {
126 Profile* profile = 125 Profile* profile =
127 Profile::FromBrowserContext(web_contents->GetBrowserContext()); 126 Profile::FromBrowserContext(web_contents->GetBrowserContext());
128 if (profile->IsOffTheRecord() || profile->IsGuestSession()) 127 if (profile->IsOffTheRecord() || profile->IsGuestSession())
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 if (!operation_success) { 421 if (!operation_success) {
423 LOG(WARNING) << "PlatformVerificationFlow: Failed to renew platform " 422 LOG(WARNING) << "PlatformVerificationFlow: Failed to renew platform "
424 "certificate."; 423 "certificate.";
425 return; 424 return;
426 } 425 }
427 VLOG(1) << "Certificate successfully renewed."; 426 VLOG(1) << "Certificate successfully renewed.";
428 } 427 }
429 428
430 } // namespace attestation 429 } // namespace attestation
431 } // namespace chromeos 430 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698