OLD | NEW |
---|---|
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 Loading... | |
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 NotifyRendererAboutLoggingActivityState(); |
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 Loading... | |
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_UpdateLoggingState, | |
249 NotifyRendererAboutLoggingActivityState) | |
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 Loading... | |
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::NotifyRendererAboutLoggingActivityState() { | |
Ilya Sherman
2014/06/14 00:50:39
Optional nit: "About" -> "Of" for a slightly short
vabr (Chromium)
2014/06/20 10:47:04
Done.
| |
306 if (!web_contents()) | |
307 return; | |
308 | |
309 // Also inform the renderer process to start or stop logging. | |
Ilya Sherman
2014/06/14 00:50:39
nit: Please update this comment.
vabr (Chromium)
2014/06/20 10:47:04
Done. (Removed, since the whole method is just for
| |
310 web_contents()->GetRenderViewHost()->Send(new AutofillMsg_ChangeLoggingState( | |
311 web_contents()->GetRenderViewHost()->GetRoutingID(), | |
312 can_use_log_router_)); | |
313 } | |
314 | |
309 void ChromePasswordManagerClient::CommitFillPasswordForm( | 315 void ChromePasswordManagerClient::CommitFillPasswordForm( |
310 autofill::PasswordFormFillData* data) { | 316 autofill::PasswordFormFillData* data) { |
311 driver_.FillPasswordForm(*data); | 317 driver_.FillPasswordForm(*data); |
312 } | 318 } |
313 | 319 |
314 bool ChromePasswordManagerClient::IsTheHotNewBubbleUIEnabled() { | 320 bool ChromePasswordManagerClient::IsTheHotNewBubbleUIEnabled() { |
315 #if !defined(USE_AURA) | 321 #if !defined(USE_AURA) |
316 return false; | 322 return false; |
317 #endif | 323 #endif |
318 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 324 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
319 if (command_line->HasSwitch(switches::kDisableSavePasswordBubble)) | 325 if (command_line->HasSwitch(switches::kDisableSavePasswordBubble)) |
320 return false; | 326 return false; |
321 | 327 |
322 if (command_line->HasSwitch(switches::kEnableSavePasswordBubble)) | 328 if (command_line->HasSwitch(switches::kEnableSavePasswordBubble)) |
323 return true; | 329 return true; |
324 | 330 |
325 std::string group_name = | 331 std::string group_name = |
326 base::FieldTrialList::FindFullName("PasswordManagerUI"); | 332 base::FieldTrialList::FindFullName("PasswordManagerUI"); |
327 | 333 |
328 // The bubble should be the default case that runs on the bots. | 334 // The bubble should be the default case that runs on the bots. |
329 return group_name != "Infobar"; | 335 return group_name != "Infobar"; |
330 } | 336 } |
OLD | NEW |