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

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/extensions/extension_service.h"
8 #include "chrome/browser/ui/browser_finder.h" 9 #include "chrome/browser/ui/browser_finder.h"
9 #include "chrome/browser/ui/browser_window.h" 10 #include "chrome/browser/ui/browser_window.h"
10 #include "chrome/browser/ui/singleton_tabs.h" 11 #include "chrome/browser/ui/singleton_tabs.h"
11 #include "chrome/common/url_constants.h" 12 #include "chrome/common/url_constants.h"
12 #include "components/web_modal/web_contents_modal_dialog_host.h" 13 #include "components/web_modal/web_contents_modal_dialog_host.h"
13 #include "components/web_modal/web_contents_modal_dialog_manager.h" 14 #include "components/web_modal/web_contents_modal_dialog_manager.h"
14 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h" 15 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h"
15 #include "content/public/browser/web_contents.h" 16 #include "content/public/browser/web_contents.h"
17 #include "extensions/browser/extension_system.h"
18 #include "extensions/common/extension.h"
16 #include "grit/generated_resources.h" 19 #include "grit/generated_resources.h"
17 #include "ui/aura/window.h" 20 #include "ui/aura/window.h"
18 #include "ui/base/l10n/l10n_util.h" 21 #include "ui/base/l10n/l10n_util.h"
19 #include "ui/views/border.h" 22 #include "ui/views/border.h"
20 #include "ui/views/controls/styled_label.h" 23 #include "ui/views/controls/styled_label.h"
21 #include "ui/views/layout/fill_layout.h" 24 #include "ui/views/layout/fill_layout.h"
22 #include "ui/views/layout/layout_constants.h" 25 #include "ui/views/layout/layout_constants.h"
23 #include "ui/views/widget/widget.h" 26 #include "ui/views/widget/widget.h"
24 27
25 namespace chromeos { 28 namespace chromeos {
26 namespace attestation { 29 namespace attestation {
27 30
28 namespace { 31 namespace {
29 32
30 const int kDialogMaxWidthInPixel = 400; 33 const int kDialogMaxWidthInPixel = 400;
31 34
32 } // namespace 35 } // namespace
33 36
34 // static 37 // static
35 void PlatformVerificationDialog::ShowDialog( 38 void PlatformVerificationDialog::ShowDialog(
36 content::WebContents* web_contents, 39 content::WebContents* web_contents,
37 const PlatformVerificationFlow::Delegate::ConsentCallback& callback) { 40 const PlatformVerificationFlow::Delegate::ConsentCallback& callback) {
38 std::string origin = web_contents->GetLastCommittedURL().GetOrigin().spec(); 41 GURL url = web_contents->GetLastCommittedURL();
42 std::string origin = url.GetOrigin().spec();
43 // In the case of an extension or hosted app, the origin of the request is
44 // best described by the extension / app name.
45 const extensions::Extension* extension =
46 extensions::ExtensionSystem::Get(web_contents->GetBrowserContext())->
47 extension_service()->GetInstalledExtensionByUrl(url);
not at google - send to devlin 2014/02/19 03:37:21 could you use ExtensionRegistry instead? we're try
Darren Krahn 2014/02/19 18:11:26 Done.
48 if (extension)
49 origin = extension->name();
39 50
40 PlatformVerificationDialog* dialog = new PlatformVerificationDialog( 51 PlatformVerificationDialog* dialog = new PlatformVerificationDialog(
41 chrome::FindBrowserWithWebContents(web_contents), 52 chrome::FindBrowserWithWebContents(web_contents),
42 base::UTF8ToUTF16(origin), 53 base::UTF8ToUTF16(origin),
43 callback); 54 callback);
44 55
45 // Sets up the dialog widget and shows it. 56 // Sets up the dialog widget and shows it.
46 web_modal::WebContentsModalDialogManager* web_contents_modal_dialog_manager = 57 web_modal::WebContentsModalDialogManager* web_contents_modal_dialog_manager =
47 web_modal::WebContentsModalDialogManager::FromWebContents(web_contents); 58 web_modal::WebContentsModalDialogManager::FromWebContents(web_contents);
48 web_modal::WebContentsModalDialogManagerDelegate* modal_delegate = 59 web_modal::WebContentsModalDialogManagerDelegate* modal_delegate =
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 } 122 }
112 123
113 void PlatformVerificationDialog::StyledLabelLinkClicked(const gfx::Range& range, 124 void PlatformVerificationDialog::StyledLabelLinkClicked(const gfx::Range& range,
114 int event_flags) { 125 int event_flags) {
115 chrome::ShowSingletonTab(browser_, GURL( 126 chrome::ShowSingletonTab(browser_, GURL(
116 chrome::kEnhancedPlaybackNotificationLearnMoreURL)); 127 chrome::kEnhancedPlaybackNotificationLearnMoreURL));
117 } 128 }
118 129
119 } // namespace attestation 130 } // namespace attestation
120 } // namespace chromeos 131 } // 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