| 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 // ExternalProtocolHandler | 20 // ExternalProtocolHandler |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 case NSAlertFirstButtonReturn: | 100 case NSAlertFirstButtonReturn: |
| 100 blockState = ExternalProtocolHandler::DONT_BLOCK; | 101 blockState = ExternalProtocolHandler::DONT_BLOCK; |
| 101 break; | 102 break; |
| 102 case NSAlertSecondButtonReturn: | 103 case NSAlertSecondButtonReturn: |
| 103 blockState = ExternalProtocolHandler::BLOCK; | 104 blockState = ExternalProtocolHandler::BLOCK; |
| 104 break; | 105 break; |
| 105 default: | 106 default: |
| 106 NOTREACHED(); | 107 NOTREACHED(); |
| 107 } | 108 } |
| 108 | 109 |
| 110 content::WebContents* web_contents = |
| 111 tab_util::GetWebContentsByID(render_process_host_id_, routing_id_); |
| 112 |
| 109 // Set the "don't warn me again" info. | 113 // Set the "don't warn me again" info. |
| 110 if ([[alert_ suppressionButton] state] == NSOnState) { | 114 if ([[alert_ suppressionButton] state] == NSOnState) { |
| 111 ExternalProtocolHandler::SetBlockState(url_.scheme(), blockState); | 115 Profile* profile = |
| 116 Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
| 117 |
| 118 ExternalProtocolHandler::SetBlockState(url_.scheme(), blockState, profile); |
| 112 ExternalProtocolHandler::RecordMetrics(true); | 119 ExternalProtocolHandler::RecordMetrics(true); |
| 113 } else { | 120 } else { |
| 114 ExternalProtocolHandler::RecordMetrics(false); | 121 ExternalProtocolHandler::RecordMetrics(false); |
| 115 } | 122 } |
| 116 | 123 |
| 117 if (blockState == ExternalProtocolHandler::DONT_BLOCK) { | 124 if (blockState == ExternalProtocolHandler::DONT_BLOCK) { |
| 118 UMA_HISTOGRAM_LONG_TIMES("clickjacking.launch_url", | 125 UMA_HISTOGRAM_LONG_TIMES("clickjacking.launch_url", |
| 119 base::Time::Now() - creation_time_); | 126 base::Time::Now() - creation_time_); |
| 120 | 127 |
| 121 content::WebContents* web_contents = | |
| 122 tab_util::GetWebContentsByID(render_process_host_id_, routing_id_); | |
| 123 | |
| 124 ExternalProtocolHandler::LaunchUrlWithoutSecurityCheck(url_, web_contents); | 128 ExternalProtocolHandler::LaunchUrlWithoutSecurityCheck(url_, web_contents); |
| 125 } | 129 } |
| 126 | 130 |
| 127 [self autorelease]; | 131 [self autorelease]; |
| 128 } | 132 } |
| 129 | 133 |
| 130 @end | 134 @end |
| OLD | NEW |