| OLD | NEW |
| 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/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/ui/browser_finder.h" | 9 #include "chrome/browser/ui/browser_finder.h" |
| 10 #include "chrome/browser/ui/browser_navigator.h" | 10 #include "chrome/browser/ui/browser_navigator.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 const extensions::Extension* extension = | 46 const extensions::Extension* extension = |
| 47 extensions::ExtensionRegistry::Get(web_contents->GetBrowserContext())-> | 47 extensions::ExtensionRegistry::Get(web_contents->GetBrowserContext())-> |
| 48 enabled_extensions().GetExtensionOrAppByURL(url); | 48 enabled_extensions().GetExtensionOrAppByURL(url); |
| 49 std::string origin = extension ? extension->name() : url.GetOrigin().spec(); | 49 std::string origin = extension ? extension->name() : url.GetOrigin().spec(); |
| 50 | 50 |
| 51 PlatformVerificationDialog* dialog = new PlatformVerificationDialog( | 51 PlatformVerificationDialog* dialog = new PlatformVerificationDialog( |
| 52 web_contents, | 52 web_contents, |
| 53 base::UTF8ToUTF16(origin), | 53 base::UTF8ToUTF16(origin), |
| 54 callback); | 54 callback); |
| 55 | 55 |
| 56 // Sets up the dialog widget and shows it. | 56 web_modal::WebContentsModalDialogManager* manager = |
| 57 web_modal::WebContentsModalDialogManager* web_contents_modal_dialog_manager = | |
| 58 web_modal::WebContentsModalDialogManager::FromWebContents(web_contents); | 57 web_modal::WebContentsModalDialogManager::FromWebContents(web_contents); |
| 59 web_modal::WebContentsModalDialogManagerDelegate* modal_delegate = | 58 const gfx::NativeWindow parent = |
| 60 web_contents_modal_dialog_manager->delegate(); | 59 manager->delegate()->GetWebContentsModalDialogHost()->GetHostView(); |
| 61 views::Widget* widget = views::Widget::CreateWindowAsFramelessChild( | 60 views::Widget* widget = CreateDialogWidget(dialog, NULL, parent); |
| 62 dialog, modal_delegate->GetWebContentsModalDialogHost()->GetHostView()); | 61 manager->ShowModalDialog(widget->GetNativeView()); |
| 63 web_contents_modal_dialog_manager->ShowModalDialog( | |
| 64 widget->GetNativeView()); | |
| 65 widget->Show(); | 62 widget->Show(); |
| 66 } | 63 } |
| 67 | 64 |
| 68 PlatformVerificationDialog::~PlatformVerificationDialog() { | 65 PlatformVerificationDialog::~PlatformVerificationDialog() { |
| 69 } | 66 } |
| 70 | 67 |
| 71 PlatformVerificationDialog::PlatformVerificationDialog( | 68 PlatformVerificationDialog::PlatformVerificationDialog( |
| 72 content::WebContents* web_contents, | 69 content::WebContents* web_contents, |
| 73 const base::string16& domain, | 70 const base::string16& domain, |
| 74 const PlatformVerificationFlow::Delegate::ConsentCallback& callback) | 71 const PlatformVerificationFlow::Delegate::ConsentCallback& callback) |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 profile, learn_more_url, content::PAGE_TRANSITION_LINK); | 140 profile, learn_more_url, content::PAGE_TRANSITION_LINK); |
| 144 params.disposition = SINGLETON_TAB; | 141 params.disposition = SINGLETON_TAB; |
| 145 chrome::Navigate(¶ms); | 142 chrome::Navigate(¶ms); |
| 146 } else { | 143 } else { |
| 147 chrome::ShowSingletonTab(browser, learn_more_url); | 144 chrome::ShowSingletonTab(browser, learn_more_url); |
| 148 } | 145 } |
| 149 } | 146 } |
| 150 | 147 |
| 151 } // namespace attestation | 148 } // namespace attestation |
| 152 } // namespace chromeos | 149 } // namespace chromeos |
| OLD | NEW |