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