summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/api/passwords_private
diff options
context:
space:
mode:
authorrdevlin.cronin <rdevlin.cronin@chromium.org>2015-06-16 13:02:56 -0700
committerCommit bot <commit-bot@chromium.org>2015-06-16 20:04:29 +0000
commitfccacdca58722bee1497fcb7f5cfc2780732a4e0 (patch)
treef72ec4547e53ae76cf4bca8ddbf0854f6b3cf3c6 /chrome/browser/extensions/api/passwords_private
parent92afd41b1d86710bc430d1647ab5ad1ecb6551b4 (diff)
downloadchromium_src-fccacdca58722bee1497fcb7f5cfc2780732a4e0.zip
chromium_src-fccacdca58722bee1497fcb7f5cfc2780732a4e0.tar.gz
chromium_src-fccacdca58722bee1497fcb7f5cfc2780732a4e0.tar.bz2
[Extensions OOPI] Update extension functions to use RFH pt 3
Continue updating extension functions to use RenderFrameHost instead of RenderViewHost. This removes all remaining uses of the RenderViewHost except for: - IPC messages - RenderViewHost::Zoom - GetMediaFileSystemsForExtension Update ExtensionFunction::render_view_host() to be render_view_host_do_not_use() to help prevent future uses. BUG=455776 Review URL: https://codereview.chromium.org/1180073005 Cr-Commit-Position: refs/heads/master@{#334671}
Diffstat (limited to 'chrome/browser/extensions/api/passwords_private')
-rw-r--r--chrome/browser/extensions/api/passwords_private/passwords_private_api.cc7
-rw-r--r--chrome/browser/extensions/api/passwords_private/passwords_private_apitest.cc7
-rw-r--r--chrome/browser/extensions/api/passwords_private/passwords_private_delegate.h9
-rw-r--r--chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc28
-rw-r--r--chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.h20
5 files changed, 31 insertions, 40 deletions
diff --git a/chrome/browser/extensions/api/passwords_private/passwords_private_api.cc b/chrome/browser/extensions/api/passwords_private/passwords_private_api.cc
index 11f4926..64f67f2 100644
--- a/chrome/browser/extensions/api/passwords_private/passwords_private_api.cc
+++ b/chrome/browser/extensions/api/passwords_private/passwords_private_api.cc
@@ -84,10 +84,9 @@ ExtensionFunction::ResponseAction
PasswordsPrivateDelegate* delegate =
PasswordsPrivateDelegateFactory::GetForBrowserContext(browser_context());
- delegate->RequestShowPassword(
- parameters->login_pair.origin_url,
- parameters->login_pair.username,
- render_view_host());
+ delegate->RequestShowPassword(parameters->login_pair.origin_url,
+ parameters->login_pair.username,
+ GetSenderWebContents());
// No response given from this API function; instead, listeners wait for the
// chrome.passwordsPrivate.onPlaintextPasswordRetrieved event to fire.
diff --git a/chrome/browser/extensions/api/passwords_private/passwords_private_apitest.cc b/chrome/browser/extensions/api/passwords_private/passwords_private_apitest.cc
index 7c462fa..2373a24 100644
--- a/chrome/browser/extensions/api/passwords_private/passwords_private_apitest.cc
+++ b/chrome/browser/extensions/api/passwords_private/passwords_private_apitest.cc
@@ -91,10 +91,9 @@ class TestDelegate : public PasswordsPrivateDelegate {
SendPasswordExceptionsList();
}
- void RequestShowPassword(
- const std::string& origin_url,
- const std::string& username,
- const content::RenderViewHost* render_view_host) override {
+ void RequestShowPassword(const std::string& origin_url,
+ const std::string& username,
+ content::WebContents* web_contents) override {
// Return a mocked password value.
std::string plaintext_password(kPlaintextPassword);
observers_->Notify(
diff --git a/chrome/browser/extensions/api/passwords_private/passwords_private_delegate.h b/chrome/browser/extensions/api/passwords_private/passwords_private_delegate.h
index 4683e28..3701724 100644
--- a/chrome/browser/extensions/api/passwords_private/passwords_private_delegate.h
+++ b/chrome/browser/extensions/api/passwords_private/passwords_private_delegate.h
@@ -26,7 +26,7 @@ class Value;
}
namespace content {
-class RenderViewHost;
+class WebContents;
}
namespace extensions {
@@ -84,10 +84,9 @@ class PasswordsPrivateDelegate : public KeyedService {
// |username| The username used in conjunction with the saved password.
// |native_window| The Chrome host window; will be used to show an OS-level
// authentication dialog if necessary.
- virtual void RequestShowPassword(
- const std::string& origin_url,
- const std::string& username,
- const content::RenderViewHost* render_view_host) = 0;
+ virtual void RequestShowPassword(const std::string& origin_url,
+ const std::string& username,
+ content::WebContents* web_contents) = 0;
};
} // namespace extensions
diff --git a/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc b/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc
index d6ae163..d786adb 100644
--- a/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc
+++ b/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc
@@ -33,7 +33,7 @@ PasswordsPrivateDelegateImpl::PasswordsPrivateDelegateImpl(Profile* profile)
set_password_exception_list_called_(false),
is_initialized_(false),
languages_(profile->GetPrefs()->GetString(prefs::kAcceptLanguages)),
- render_view_host_(nullptr),
+ web_contents_(nullptr),
observers_(new base::ObserverListThreadSafe<Observer>()) {
password_manager_presenter_->Initialize();
password_manager_presenter_->UpdatePasswordLists();
@@ -101,32 +101,29 @@ void PasswordsPrivateDelegateImpl::RemovePasswordExceptionInternal(
void PasswordsPrivateDelegateImpl::RequestShowPassword(
const std::string& origin_url,
const std::string& username,
- const content::RenderViewHost* render_view_host) {
- ExecuteFunction(base::Bind(
- &PasswordsPrivateDelegateImpl::RequestShowPasswordInternal,
- base::Unretained(this),
- origin_url,
- username,
- render_view_host));
+ content::WebContents* web_contents) {
+ ExecuteFunction(
+ base::Bind(&PasswordsPrivateDelegateImpl::RequestShowPasswordInternal,
+ base::Unretained(this), origin_url, username, web_contents));
}
void PasswordsPrivateDelegateImpl::RequestShowPasswordInternal(
const std::string& origin_url,
const std::string& username,
- const content::RenderViewHost* render_view_host) {
+ content::WebContents* web_contents) {
std::string key = LoginPairToMapKey(origin_url, username);
if (login_pair_to_index_map_.find(key) == login_pair_to_index_map_.end()) {
// If the URL/username pair does not exist in the map, do nothing.
return;
}
- // Save |render_view_host| so that the call to RequestShowPassword() below can
- // call use this value by calling GetNativeWindow(). Note: This is safe
- // because GetNativeWindow() will only be called immediately from
+ // Save |web_contents| so that the call to RequestShowPassword() below
+ // can use this value by calling GetNativeWindow(). Note: This is safe because
+ // GetNativeWindow() will only be called immediately from
// RequestShowPassword().
// TODO(stevenjb): Pass this directly to RequestShowPassword(); see
// crbug.com/495290.
- render_view_host_ = render_view_host;
+ web_contents_ = web_contents;
// Request the password. When it is retrieved, ShowPassword() will be called.
password_manager_presenter_->RequestShowPassword(
@@ -227,9 +224,8 @@ void PasswordsPrivateDelegateImpl::SendPasswordExceptionsList() {
#if !defined(OS_ANDROID)
gfx::NativeWindow PasswordsPrivateDelegateImpl::GetNativeWindow() const {
- DCHECK(render_view_host_);
- return content::WebContents::FromRenderViewHost(render_view_host_)
- ->GetTopLevelNativeWindow();
+ DCHECK(web_contents_);
+ return web_contents_->GetTopLevelNativeWindow();
}
#endif
diff --git a/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.h b/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.h
index 5d94a63..63207cb 100644
--- a/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.h
+++ b/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.h
@@ -23,7 +23,7 @@
class Profile;
namespace content {
-class RenderViewHost;
+class WebContents;
}
namespace extensions {
@@ -41,10 +41,9 @@ class PasswordsPrivateDelegateImpl : public PasswordsPrivateDelegate,
void RemoveSavedPassword(
const std::string& origin_url, const std::string& username) override;
void RemovePasswordException(const std::string& exception_url) override;
- void RequestShowPassword(
- const std::string& origin_url,
- const std::string& username,
- const content::RenderViewHost* render_view_host) override;
+ void RequestShowPassword(const std::string& origin_url,
+ const std::string& username,
+ content::WebContents* web_contents) override;
// PasswordUIView implementation.
Profile* GetProfile() override;
@@ -78,10 +77,9 @@ class PasswordsPrivateDelegateImpl : public PasswordsPrivateDelegate,
void RemoveSavedPasswordInternal(
const std::string& origin_url, const std::string& username);
void RemovePasswordExceptionInternal(const std::string& exception_url);
- void RequestShowPasswordInternal(
- const std::string& origin_url,
- const std::string& username,
- const content::RenderViewHost* render_view_host);
+ void RequestShowPasswordInternal(const std::string& origin_url,
+ const std::string& username,
+ content::WebContents* web_contents);
void SendSavedPasswordsList();
void SendPasswordExceptionsList();
@@ -113,9 +111,9 @@ class PasswordsPrivateDelegateImpl : public PasswordsPrivateDelegate,
// User pref for storing accept languages.
std::string languages_;
- // The RenderViewHost used when invoking this API. Used to fetch the
+ // The WebContents used when invoking this API. Used to fetch the
// NativeWindow for the window where the API was called.
- const content::RenderViewHost* render_view_host_;
+ content::WebContents* web_contents_;
// The observers.
scoped_refptr<base::ObserverListThreadSafe<Observer>> observers_;