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

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

Issue 1942353002: (reland) Move permission.mojom from WebKit/public/platform/ to components/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
13 #include "base/metrics/histogram.h" 13 #include "base/metrics/histogram.h"
14 #include "base/time/time.h" 14 #include "base/time/time.h"
15 #include "base/timer/timer.h" 15 #include "base/timer/timer.h"
16 #include "chrome/browser/chromeos/attestation/attestation_ca_client.h" 16 #include "chrome/browser/chromeos/attestation/attestation_ca_client.h"
17 #include "chrome/browser/chromeos/attestation/attestation_signed_data.pb.h" 17 #include "chrome/browser/chromeos/attestation/attestation_signed_data.pb.h"
18 #include "chrome/browser/chromeos/profiles/profile_helper.h" 18 #include "chrome/browser/chromeos/profiles/profile_helper.h"
19 #include "chrome/browser/chromeos/settings/cros_settings.h" 19 #include "chrome/browser/chromeos/settings/cros_settings.h"
20 #include "chrome/browser/permissions/permission_manager.h" 20 #include "chrome/browser/permissions/permission_manager.h"
21 #include "chrome/browser/profiles/profile.h" 21 #include "chrome/browser/profiles/profile.h"
22 #include "chromeos/attestation/attestation_flow.h" 22 #include "chromeos/attestation/attestation_flow.h"
23 #include "chromeos/chromeos_switches.h" 23 #include "chromeos/chromeos_switches.h"
24 #include "chromeos/cryptohome/async_method_caller.h" 24 #include "chromeos/cryptohome/async_method_caller.h"
25 #include "chromeos/cryptohome/cryptohome_parameters.h" 25 #include "chromeos/cryptohome/cryptohome_parameters.h"
26 #include "chromeos/dbus/cryptohome_client.h" 26 #include "chromeos/dbus/cryptohome_client.h"
27 #include "chromeos/dbus/dbus_thread_manager.h" 27 #include "chromeos/dbus/dbus_thread_manager.h"
28 #include "components/content_settings/core/browser/host_content_settings_map.h" 28 #include "components/content_settings/core/browser/host_content_settings_map.h"
29 #include "components/content_settings/core/common/content_settings_pattern.h" 29 #include "components/content_settings/core/common/content_settings_pattern.h"
30 #include "components/permissions/permission_status.mojom.h"
30 #include "components/user_manager/user.h" 31 #include "components/user_manager/user.h"
31 #include "content/public/browser/browser_context.h" 32 #include "content/public/browser/browser_context.h"
32 #include "content/public/browser/browser_thread.h" 33 #include "content/public/browser/browser_thread.h"
33 #include "content/public/browser/permission_type.h" 34 #include "content/public/browser/permission_type.h"
34 #include "content/public/browser/render_process_host.h" 35 #include "content/public/browser/render_process_host.h"
35 #include "content/public/browser/render_view_host.h" 36 #include "content/public/browser/render_view_host.h"
36 #include "content/public/browser/user_metrics.h" 37 #include "content/public/browser/user_metrics.h"
37 #include "content/public/browser/web_contents.h" 38 #include "content/public/browser/web_contents.h"
38 #include "content/public/common/url_constants.h" 39 #include "content/public/common/url_constants.h"
39 #include "net/cert/pem_tokenizer.h" 40 #include "net/cert/pem_tokenizer.h"
40 #include "net/cert/x509_certificate.h" 41 #include "net/cert/x509_certificate.h"
41 #include "third_party/WebKit/public/platform/modules/permissions/permission_stat us.mojom.h"
42 42
43 namespace { 43 namespace {
44 44
45 using chromeos::attestation::PlatformVerificationFlow; 45 using chromeos::attestation::PlatformVerificationFlow;
46 46
47 const int kTimeoutInSeconds = 8; 47 const int kTimeoutInSeconds = 8;
48 const char kAttestationResultHistogram[] = 48 const char kAttestationResultHistogram[] =
49 "ChromeOS.PlatformVerification.Result"; 49 "ChromeOS.PlatformVerification.Result";
50 const char kAttestationAvailableHistogram[] = 50 const char kAttestationAvailableHistogram[] =
51 "ChromeOS.PlatformVerification.Available"; 51 "ChromeOS.PlatformVerification.Available";
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 Profile::FromBrowserContext(web_contents->GetBrowserContext())); 105 Profile::FromBrowserContext(web_contents->GetBrowserContext()));
106 } 106 }
107 107
108 bool IsPermittedByUser(content::WebContents* web_contents) override { 108 bool IsPermittedByUser(content::WebContents* web_contents) override {
109 // TODO(xhwang): Using delegate_->GetURL() here is not right. The platform 109 // TODO(xhwang): Using delegate_->GetURL() here is not right. The platform
110 // verification may be requested by a frame from a different origin. This 110 // verification may be requested by a frame from a different origin. This
111 // will be solved when http://crbug.com/454847 is fixed. 111 // will be solved when http://crbug.com/454847 is fixed.
112 const GURL& requesting_origin = GetURL(web_contents).GetOrigin(); 112 const GURL& requesting_origin = GetURL(web_contents).GetOrigin();
113 113
114 GURL embedding_origin = web_contents->GetLastCommittedURL().GetOrigin(); 114 GURL embedding_origin = web_contents->GetLastCommittedURL().GetOrigin();
115 blink::mojom::PermissionStatus status = 115 permissions::mojom::PermissionStatus status =
116 PermissionManager::Get( 116 PermissionManager::Get(
117 Profile::FromBrowserContext(web_contents->GetBrowserContext())) 117 Profile::FromBrowserContext(web_contents->GetBrowserContext()))
118 ->GetPermissionStatus( 118 ->GetPermissionStatus(
119 content::PermissionType::PROTECTED_MEDIA_IDENTIFIER, 119 content::PermissionType::PROTECTED_MEDIA_IDENTIFIER,
120 requesting_origin, embedding_origin); 120 requesting_origin, embedding_origin);
121 121
122 return status == blink::mojom::PermissionStatus::GRANTED; 122 return status == permissions::mojom::PermissionStatus::GRANTED;
123 } 123 }
124 124
125 bool IsInSupportedMode(content::WebContents* web_contents) override { 125 bool IsInSupportedMode(content::WebContents* web_contents) override {
126 Profile* profile = 126 Profile* profile =
127 Profile::FromBrowserContext(web_contents->GetBrowserContext()); 127 Profile::FromBrowserContext(web_contents->GetBrowserContext());
128 if (profile->IsOffTheRecord() || profile->IsGuestSession()) 128 if (profile->IsOffTheRecord() || profile->IsGuestSession())
129 return false; 129 return false;
130 130
131 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 131 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
132 return !command_line->HasSwitch(chromeos::switches::kSystemDevMode) || 132 return !command_line->HasSwitch(chromeos::switches::kSystemDevMode) ||
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 if (!operation_success) { 425 if (!operation_success) {
426 LOG(WARNING) << "PlatformVerificationFlow: Failed to renew platform " 426 LOG(WARNING) << "PlatformVerificationFlow: Failed to renew platform "
427 "certificate."; 427 "certificate.";
428 return; 428 return;
429 } 429 }
430 VLOG(1) << "Certificate successfully renewed."; 430 VLOG(1) << "Certificate successfully renewed.";
431 } 431 }
432 432
433 } // namespace attestation 433 } // namespace attestation
434 } // namespace chromeos 434 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/DEPS ('k') | chrome/browser/guest_view/web_view/chrome_web_view_permission_helper_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698