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

Side by Side Diff: chrome/browser/ui/cocoa/external_protocol_dialog.mm

Issue 2623033006: [Re-landing] Migrate external protocol prefs from local state to profiles (Closed)
Patch Set: a Created 3 years, 11 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
OLDNEW
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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
109 // Set the "don't warn me again" info. 110 // Set the "don't warn me again" info.
110 if ([[alert_ suppressionButton] state] == NSOnState) { 111 if ([[alert_ suppressionButton] state] == NSOnState) {
111 ExternalProtocolHandler::SetBlockState(url_.scheme(), blockState); 112 content::WebContents* web_contents =
113 tab_util::GetWebContentsByID(render_process_host_id_, routing_id_);
114 Profile* profile =
115 Profile::FromBrowserContext(web_contents->GetBrowserContext());
116
117 ExternalProtocolHandler::SetBlockState(url_.scheme(), blockState, profile);
112 ExternalProtocolHandler::RecordMetrics(true); 118 ExternalProtocolHandler::RecordMetrics(true);
113 } else { 119 } else {
114 ExternalProtocolHandler::RecordMetrics(false); 120 ExternalProtocolHandler::RecordMetrics(false);
115 } 121 }
116 122
117 if (blockState == ExternalProtocolHandler::DONT_BLOCK) { 123 if (blockState == ExternalProtocolHandler::DONT_BLOCK) {
118 UMA_HISTOGRAM_LONG_TIMES("clickjacking.launch_url", 124 UMA_HISTOGRAM_LONG_TIMES("clickjacking.launch_url",
119 base::Time::Now() - creation_time_); 125 base::Time::Now() - creation_time_);
120 126
121 content::WebContents* web_contents = 127 content::WebContents* web_contents =
tapted 2017/01/23 05:07:54 nit: move this up to line ~110 and reuse
ramyasharma 2017/01/23 06:41:26 Done.
122 tab_util::GetWebContentsByID(render_process_host_id_, routing_id_); 128 tab_util::GetWebContentsByID(render_process_host_id_, routing_id_);
123 129
124 ExternalProtocolHandler::LaunchUrlWithoutSecurityCheck(url_, web_contents); 130 ExternalProtocolHandler::LaunchUrlWithoutSecurityCheck(url_, web_contents);
125 } 131 }
126 132
127 [self autorelease]; 133 [self autorelease];
128 } 134 }
129 135
130 @end 136 @end
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile.cc ('k') | chrome/browser/ui/external_protocol_dialog_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698