Index: chrome/browser/password_manager/chrome_password_manager_client.cc |
diff --git a/chrome/browser/password_manager/chrome_password_manager_client.cc b/chrome/browser/password_manager/chrome_password_manager_client.cc |
index ab2f0d809b36cca89f7ca3ab0c5df4836e784696..75af03fc191ce682d0243b510458b6063bde8ac5 100644 |
--- a/chrome/browser/password_manager/chrome_password_manager_client.cc |
+++ b/chrome/browser/password_manager/chrome_password_manager_client.cc |
@@ -26,12 +26,12 @@ |
#include "components/autofill/content/common/autofill_messages.h" |
#include "components/autofill/core/browser/password_generator.h" |
#include "components/autofill/core/common/password_form.h" |
+#include "components/password_manager/content/browser/content_password_manager_driver.h" |
#include "components/password_manager/content/browser/password_manager_internals_service_factory.h" |
#include "components/password_manager/content/common/credential_manager_messages.h" |
#include "components/password_manager/content/common/credential_manager_types.h" |
#include "components/password_manager/core/browser/log_receiver.h" |
#include "components/password_manager/core/browser/password_form_manager.h" |
-#include "components/password_manager/core/browser/password_manager.h" |
#include "components/password_manager/core/browser/password_manager_internals_service.h" |
#include "components/password_manager/core/browser/password_manager_metrics_util.h" |
#include "components/password_manager/core/common/password_manager_switches.h" |
@@ -68,12 +68,14 @@ ChromePasswordManagerClient::ChromePasswordManagerClient( |
autofill::AutofillClient* autofill_client) |
: content::WebContentsObserver(web_contents), |
profile_(Profile::FromBrowserContext(web_contents->GetBrowserContext())), |
- driver_(web_contents, this, autofill_client), |
+ password_manager_(this), |
+ driver_factory_(web_contents, this, autofill_client), |
credential_manager_dispatcher_(web_contents, this), |
- observer_(NULL), |
+ observer_(nullptr), |
can_use_log_router_(false), |
autofill_sync_state_(ALLOW_SYNC_CREDENTIALS), |
- sync_credential_was_filtered_(false) { |
+ sync_credential_was_filtered_(false), |
+ render_frame_host_source_(nullptr) { |
PasswordManagerInternalsService* service = |
PasswordManagerInternalsServiceFactory::GetForBrowserContext(profile_); |
if (service) |
@@ -226,11 +228,6 @@ ChromePasswordManagerClient::GetPasswordStore() { |
.get(); |
} |
-password_manager::PasswordManagerDriver* |
-ChromePasswordManagerClient::GetDriver() { |
- return &driver_; |
-} |
- |
base::FieldTrial::Probability |
ChromePasswordManagerClient::GetProbabilityForExperiment( |
const std::string& experiment_name) { |
@@ -290,26 +287,22 @@ bool ChromePasswordManagerClient::IsLoggingActive() const { |
return can_use_log_router_ && !web_contents()->GetWebUI(); |
} |
-// static |
-password_manager::PasswordGenerationManager* |
-ChromePasswordManagerClient::GetGenerationManagerFromWebContents( |
- content::WebContents* contents) { |
- ChromePasswordManagerClient* client = |
- ChromePasswordManagerClient::FromWebContents(contents); |
- if (!client) |
- return NULL; |
- return client->GetDriver()->GetPasswordGenerationManager(); |
+bool ChromePasswordManagerClient::DidLastPageLoadEncounterSSLErrors() { |
+ content::NavigationEntry* entry = |
+ web_contents()->GetController().GetLastCommittedEntry(); |
+ if (!entry) |
+ return false; |
+ |
+ return net::IsCertStatusError(entry->GetSSL().cert_status); |
+} |
+ |
+bool ChromePasswordManagerClient::IsOffTheRecord() { |
+ return web_contents()->GetBrowserContext()->IsOffTheRecord(); |
} |
-// static |
password_manager::PasswordManager* |
-ChromePasswordManagerClient::GetManagerFromWebContents( |
- content::WebContents* contents) { |
- ChromePasswordManagerClient* client = |
- ChromePasswordManagerClient::FromWebContents(contents); |
- if (!client) |
- return NULL; |
- return client->GetDriver()->GetPasswordManager(); |
+ChromePasswordManagerClient::GetPasswordManager() { |
+ return &password_manager_; |
} |
void ChromePasswordManagerClient::SetTestObserver( |
@@ -318,7 +311,10 @@ void ChromePasswordManagerClient::SetTestObserver( |
} |
bool ChromePasswordManagerClient::OnMessageReceived( |
- const IPC::Message& message) { |
+ const IPC::Message& message, |
+ content::RenderFrameHost* render_frame_host) { |
+ render_frame_host_source_ = render_frame_host; |
+ |
bool handled = true; |
IPC_BEGIN_MESSAGE_MAP(ChromePasswordManagerClient, message) |
jam
2014/11/17 23:13:21
use IPC_BEGIN_MESSAGE_MAP_WITH_PARAM instead, and
Evan Stade
2014/11/18 00:39:05
Done. Any problem with using two message maps in a
jam
2014/11/18 17:33:51
why are you using two instead of just one? i reali
Evan Stade
2014/11/18 19:39:29
A couple of the message handling functions are cal
jam
2014/11/19 17:43:27
I see, I didn't realize they're called from elsewh
Evan Stade
2014/11/19 22:20:04
Done.
|
// Autofill messages: |
@@ -334,6 +330,8 @@ bool ChromePasswordManagerClient::OnMessageReceived( |
// Default: |
IPC_MESSAGE_UNHANDLED(handled = false) |
IPC_END_MESSAGE_MAP() |
+ |
+ render_frame_host_source_ = nullptr; |
return handled; |
} |
@@ -353,14 +351,10 @@ void ChromePasswordManagerClient::ShowPasswordGenerationPopup( |
popup_controller_ = |
autofill::PasswordGenerationPopupControllerImpl::GetOrCreate( |
- popup_controller_, |
- element_bounds_in_screen_space, |
- form, |
- max_length, |
- driver_.GetPasswordManager(), |
- observer_, |
- web_contents(), |
- web_contents()->GetNativeView()); |
+ popup_controller_, element_bounds_in_screen_space, form, max_length, |
+ &password_manager_, |
+ driver_factory_.GetDriverForFrame(render_frame_host_source_), |
+ observer_, web_contents(), web_contents()->GetNativeView()); |
popup_controller_->Show(true /* display_password */); |
} |
@@ -370,14 +364,11 @@ void ChromePasswordManagerClient::ShowPasswordEditingPopup( |
gfx::RectF element_bounds_in_screen_space = GetBoundsInScreenSpace(bounds); |
popup_controller_ = |
autofill::PasswordGenerationPopupControllerImpl::GetOrCreate( |
- popup_controller_, |
- element_bounds_in_screen_space, |
- form, |
+ popup_controller_, element_bounds_in_screen_space, form, |
0, // Unspecified max length. |
- driver_.GetPasswordManager(), |
- observer_, |
- web_contents(), |
- web_contents()->GetNativeView()); |
+ &password_manager_, |
+ driver_factory_.GetDriverForFrame(render_frame_host_source_), |
+ observer_, web_contents(), web_contents()->GetNativeView()); |
popup_controller_->Show(false /* display_password */); |
} |