| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #import "chrome/browser/ui/cocoa/external_protocol_dialog.h" | 5 #import "chrome/browser/ui/cocoa/external_protocol_dialog.h" |
| 6 | 6 |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
| 9 #include "chrome/browser/external_protocol/external_protocol_handler.h" | 9 #include "chrome/browser/external_protocol/external_protocol_handler.h" |
| 10 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/shell_integration.h" | 11 #include "chrome/browser/shell_integration.h" |
| 11 #include "chrome/browser/tab_contents/tab_util.h" | 12 #include "chrome/browser/tab_contents/tab_util.h" |
| 12 #include "chrome/grit/chromium_strings.h" | 13 #include "chrome/grit/chromium_strings.h" |
| 13 #include "chrome/grit/generated_resources.h" | 14 #include "chrome/grit/generated_resources.h" |
| 14 #include "components/strings/grit/components_strings.h" | 15 #include "components/strings/grit/components_strings.h" |
| 15 #include "ui/base/l10n/l10n_util_mac.h" | 16 #include "ui/base/l10n/l10n_util_mac.h" |
| 16 #include "ui/gfx/text_elider.h" | 17 #include "ui/gfx/text_elider.h" |
| 17 | 18 |
| 18 /////////////////////////////////////////////////////////////////////////////// | 19 /////////////////////////////////////////////////////////////////////////////// |
| 19 // ExternalProtocolDialogController | 20 // ExternalProtocolDialogController |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 case NSAlertFirstButtonReturn: | 88 case NSAlertFirstButtonReturn: |
| 88 blockState = ExternalProtocolHandler::DONT_BLOCK; | 89 blockState = ExternalProtocolHandler::DONT_BLOCK; |
| 89 break; | 90 break; |
| 90 case NSAlertSecondButtonReturn: | 91 case NSAlertSecondButtonReturn: |
| 91 blockState = ExternalProtocolHandler::BLOCK; | 92 blockState = ExternalProtocolHandler::BLOCK; |
| 92 break; | 93 break; |
| 93 default: | 94 default: |
| 94 NOTREACHED(); | 95 NOTREACHED(); |
| 95 } | 96 } |
| 96 | 97 |
| 98 content::WebContents* web_contents = |
| 99 tab_util::GetWebContentsByID(render_process_host_id_, routing_id_); |
| 100 |
| 97 // Set the "don't warn me again" info. | 101 // Set the "don't warn me again" info. |
| 98 if ([[alert_ suppressionButton] state] == NSOnState) { | 102 if ([[alert_ suppressionButton] state] == NSOnState) { |
| 99 ExternalProtocolHandler::SetBlockState(url_.scheme(), blockState); | 103 Profile* profile = |
| 104 Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
| 105 |
| 106 ExternalProtocolHandler::SetBlockState(url_.scheme(), blockState, profile); |
| 100 ExternalProtocolHandler::RecordMetrics(true); | 107 ExternalProtocolHandler::RecordMetrics(true); |
| 101 } else { | 108 } else { |
| 102 ExternalProtocolHandler::RecordMetrics(false); | 109 ExternalProtocolHandler::RecordMetrics(false); |
| 103 } | 110 } |
| 104 | 111 |
| 105 if (blockState == ExternalProtocolHandler::DONT_BLOCK) { | 112 if (blockState == ExternalProtocolHandler::DONT_BLOCK) { |
| 106 UMA_HISTOGRAM_LONG_TIMES("clickjacking.launch_url", | 113 UMA_HISTOGRAM_LONG_TIMES("clickjacking.launch_url", |
| 107 base::Time::Now() - creation_time_); | 114 base::Time::Now() - creation_time_); |
| 108 | 115 |
| 109 content::WebContents* web_contents = | |
| 110 tab_util::GetWebContentsByID(render_process_host_id_, routing_id_); | |
| 111 | |
| 112 ExternalProtocolHandler::LaunchUrlWithoutSecurityCheck(url_, web_contents); | 116 ExternalProtocolHandler::LaunchUrlWithoutSecurityCheck(url_, web_contents); |
| 113 } | 117 } |
| 114 | 118 |
| 115 [self autorelease]; | 119 [self autorelease]; |
| 116 } | 120 } |
| 117 | 121 |
| 118 @end | 122 @end |
| OLD | NEW |