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

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

Issue 171483003: Show the extension / app name for platform verification. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
« 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 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_dialog.h" 5 #include "chrome/browser/chromeos/attestation/platform_verification_dialog.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/browser/ui/browser_finder.h" 8 #include "chrome/browser/ui/browser_finder.h"
9 #include "chrome/browser/ui/browser_window.h" 9 #include "chrome/browser/ui/browser_window.h"
10 #include "chrome/browser/ui/singleton_tabs.h" 10 #include "chrome/browser/ui/singleton_tabs.h"
11 #include "chrome/common/url_constants.h" 11 #include "chrome/common/url_constants.h"
12 #include "components/web_modal/web_contents_modal_dialog_host.h" 12 #include "components/web_modal/web_contents_modal_dialog_host.h"
13 #include "components/web_modal/web_contents_modal_dialog_manager.h" 13 #include "components/web_modal/web_contents_modal_dialog_manager.h"
14 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h" 14 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h"
15 #include "content/public/browser/web_contents.h" 15 #include "content/public/browser/web_contents.h"
16 #include "extensions/browser/extension_registry.h"
17 #include "extensions/common/extension.h"
16 #include "grit/generated_resources.h" 18 #include "grit/generated_resources.h"
17 #include "ui/aura/window.h" 19 #include "ui/aura/window.h"
18 #include "ui/base/l10n/l10n_util.h" 20 #include "ui/base/l10n/l10n_util.h"
19 #include "ui/views/border.h" 21 #include "ui/views/border.h"
20 #include "ui/views/controls/styled_label.h" 22 #include "ui/views/controls/styled_label.h"
21 #include "ui/views/layout/fill_layout.h" 23 #include "ui/views/layout/fill_layout.h"
22 #include "ui/views/layout/layout_constants.h" 24 #include "ui/views/layout/layout_constants.h"
23 #include "ui/views/widget/widget.h" 25 #include "ui/views/widget/widget.h"
24 26
25 namespace chromeos { 27 namespace chromeos {
26 namespace attestation { 28 namespace attestation {
27 29
28 namespace { 30 namespace {
29 31
30 const int kDialogMaxWidthInPixel = 400; 32 const int kDialogMaxWidthInPixel = 400;
31 33
32 } // namespace 34 } // namespace
33 35
34 // static 36 // static
35 void PlatformVerificationDialog::ShowDialog( 37 void PlatformVerificationDialog::ShowDialog(
36 content::WebContents* web_contents, 38 content::WebContents* web_contents,
37 const PlatformVerificationFlow::Delegate::ConsentCallback& callback) { 39 const PlatformVerificationFlow::Delegate::ConsentCallback& callback) {
38 std::string origin = web_contents->GetLastCommittedURL().GetOrigin().spec(); 40 GURL url = web_contents->GetLastCommittedURL();
41 // In the case of an extension or hosted app, the origin of the request is
42 // best described by the extension / app name.
43 const extensions::Extension* extension =
44 extensions::ExtensionRegistry::Get(web_contents->GetBrowserContext())->
45 enabled_extensions().GetExtensionOrAppByURL(url);
46 std::string origin = extension ? extension->name() : url.GetOrigin().spec();
39 47
40 PlatformVerificationDialog* dialog = new PlatformVerificationDialog( 48 PlatformVerificationDialog* dialog = new PlatformVerificationDialog(
41 chrome::FindBrowserWithWebContents(web_contents), 49 chrome::FindBrowserWithWebContents(web_contents),
42 base::UTF8ToUTF16(origin), 50 base::UTF8ToUTF16(origin),
43 callback); 51 callback);
44 52
45 // Sets up the dialog widget and shows it. 53 // Sets up the dialog widget and shows it.
46 web_modal::WebContentsModalDialogManager* web_contents_modal_dialog_manager = 54 web_modal::WebContentsModalDialogManager* web_contents_modal_dialog_manager =
47 web_modal::WebContentsModalDialogManager::FromWebContents(web_contents); 55 web_modal::WebContentsModalDialogManager::FromWebContents(web_contents);
48 web_modal::WebContentsModalDialogManagerDelegate* modal_delegate = 56 web_modal::WebContentsModalDialogManagerDelegate* modal_delegate =
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 } 119 }
112 120
113 void PlatformVerificationDialog::StyledLabelLinkClicked(const gfx::Range& range, 121 void PlatformVerificationDialog::StyledLabelLinkClicked(const gfx::Range& range,
114 int event_flags) { 122 int event_flags) {
115 chrome::ShowSingletonTab(browser_, GURL( 123 chrome::ShowSingletonTab(browser_, GURL(
116 chrome::kEnhancedPlaybackNotificationLearnMoreURL)); 124 chrome::kEnhancedPlaybackNotificationLearnMoreURL));
117 } 125 }
118 126
119 } // namespace attestation 127 } // namespace attestation
120 } // namespace chromeos 128 } // namespace chromeos
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