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

Side by Side Diff: chrome/browser/password_manager/chrome_password_manager_client.cc

Issue 336763002: Password internals page: notify renderer about logging state on client construction (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments addressed Created 6 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/password_manager/chrome_password_manager_client.h" 5 #include "chrome/browser/password_manager/chrome_password_manager_client.h"
6 6
7 #include "base/bind_helpers.h" 7 #include "base/bind_helpers.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/memory/singleton.h" 9 #include "base/memory/singleton.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 } 182 }
183 return false; 183 return false;
184 } 184 }
185 185
186 void ChromePasswordManagerClient::OnLogRouterAvailabilityChanged( 186 void ChromePasswordManagerClient::OnLogRouterAvailabilityChanged(
187 bool router_can_be_used) { 187 bool router_can_be_used) {
188 if (can_use_log_router_ == router_can_be_used) 188 if (can_use_log_router_ == router_can_be_used)
189 return; 189 return;
190 can_use_log_router_ = router_can_be_used; 190 can_use_log_router_ = router_can_be_used;
191 191
192 if (!web_contents()) 192 NotifyRendererOfLoggingAvailability();
193 return;
194
195 // Also inform the renderer process to start or stop logging.
196 web_contents()->GetRenderViewHost()->Send(new AutofillMsg_ChangeLoggingState(
197 web_contents()->GetRenderViewHost()->GetRoutingID(),
198 can_use_log_router_));
199 } 193 }
200 194
201 void ChromePasswordManagerClient::LogSavePasswordProgress( 195 void ChromePasswordManagerClient::LogSavePasswordProgress(
202 const std::string& text) { 196 const std::string& text) {
203 if (!IsLoggingActive()) 197 if (!IsLoggingActive())
204 return; 198 return;
205 PasswordManagerInternalsService* service = 199 PasswordManagerInternalsService* service =
206 PasswordManagerInternalsServiceFactory::GetForBrowserContext(profile_); 200 PasswordManagerInternalsServiceFactory::GetForBrowserContext(profile_);
207 if (service) 201 if (service)
208 service->ProcessLog(text); 202 service->ProcessLog(text);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 bool ChromePasswordManagerClient::OnMessageReceived( 238 bool ChromePasswordManagerClient::OnMessageReceived(
245 const IPC::Message& message) { 239 const IPC::Message& message) {
246 bool handled = true; 240 bool handled = true;
247 IPC_BEGIN_MESSAGE_MAP(ChromePasswordManagerClient, message) 241 IPC_BEGIN_MESSAGE_MAP(ChromePasswordManagerClient, message)
248 IPC_MESSAGE_HANDLER(AutofillHostMsg_ShowPasswordGenerationPopup, 242 IPC_MESSAGE_HANDLER(AutofillHostMsg_ShowPasswordGenerationPopup,
249 ShowPasswordGenerationPopup) 243 ShowPasswordGenerationPopup)
250 IPC_MESSAGE_HANDLER(AutofillHostMsg_ShowPasswordEditingPopup, 244 IPC_MESSAGE_HANDLER(AutofillHostMsg_ShowPasswordEditingPopup,
251 ShowPasswordEditingPopup) 245 ShowPasswordEditingPopup)
252 IPC_MESSAGE_HANDLER(AutofillHostMsg_HidePasswordGenerationPopup, 246 IPC_MESSAGE_HANDLER(AutofillHostMsg_HidePasswordGenerationPopup,
253 HidePasswordGenerationPopup) 247 HidePasswordGenerationPopup)
248 IPC_MESSAGE_HANDLER(AutofillHostMsg_PasswordAutofillAgentConstructed,
249 NotifyRendererOfLoggingAvailability)
254 IPC_MESSAGE_UNHANDLED(handled = false) 250 IPC_MESSAGE_UNHANDLED(handled = false)
255 IPC_END_MESSAGE_MAP() 251 IPC_END_MESSAGE_MAP()
256 return handled; 252 return handled;
257 } 253 }
258 254
259 gfx::RectF ChromePasswordManagerClient::GetBoundsInScreenSpace( 255 gfx::RectF ChromePasswordManagerClient::GetBoundsInScreenSpace(
260 const gfx::RectF& bounds) { 256 const gfx::RectF& bounds) {
261 gfx::Rect client_area = web_contents()->GetContainerBounds(); 257 gfx::Rect client_area = web_contents()->GetContainerBounds();
262 return bounds + client_area.OffsetFromOrigin(); 258 return bounds + client_area.OffsetFromOrigin();
263 } 259 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 form, 295 form,
300 0, // Unspecified max length. 296 0, // Unspecified max length.
301 driver_.GetPasswordManager(), 297 driver_.GetPasswordManager(),
302 observer_, 298 observer_,
303 web_contents(), 299 web_contents(),
304 web_contents()->GetNativeView()); 300 web_contents()->GetNativeView());
305 popup_controller_->Show(false /* display_password */); 301 popup_controller_->Show(false /* display_password */);
306 #endif // defined(USE_AURA) || defined(OS_MACOSX) 302 #endif // defined(USE_AURA) || defined(OS_MACOSX)
307 } 303 }
308 304
305 void ChromePasswordManagerClient::NotifyRendererOfLoggingAvailability() {
306 if (!web_contents())
307 return;
308
309 web_contents()->GetRenderViewHost()->Send(new AutofillMsg_SetLoggingState(
310 web_contents()->GetRenderViewHost()->GetRoutingID(),
311 can_use_log_router_));
312 }
313
309 void ChromePasswordManagerClient::CommitFillPasswordForm( 314 void ChromePasswordManagerClient::CommitFillPasswordForm(
310 autofill::PasswordFormFillData* data) { 315 autofill::PasswordFormFillData* data) {
311 driver_.FillPasswordForm(*data); 316 driver_.FillPasswordForm(*data);
312 } 317 }
313 318
314 bool ChromePasswordManagerClient::IsTheHotNewBubbleUIEnabled() { 319 bool ChromePasswordManagerClient::IsTheHotNewBubbleUIEnabled() {
315 #if !defined(USE_AURA) 320 #if !defined(USE_AURA)
316 return false; 321 return false;
317 #endif 322 #endif
318 CommandLine* command_line = CommandLine::ForCurrentProcess(); 323 CommandLine* command_line = CommandLine::ForCurrentProcess();
319 if (command_line->HasSwitch(switches::kDisableSavePasswordBubble)) 324 if (command_line->HasSwitch(switches::kDisableSavePasswordBubble))
320 return false; 325 return false;
321 326
322 if (command_line->HasSwitch(switches::kEnableSavePasswordBubble)) 327 if (command_line->HasSwitch(switches::kEnableSavePasswordBubble))
323 return true; 328 return true;
324 329
325 std::string group_name = 330 std::string group_name =
326 base::FieldTrialList::FindFullName("PasswordManagerUI"); 331 base::FieldTrialList::FindFullName("PasswordManagerUI");
327 332
328 // The bubble should be the default case that runs on the bots. 333 // The bubble should be the default case that runs on the bots.
329 return group_name != "Infobar"; 334 return group_name != "Infobar";
330 } 335 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698