summaryrefslogtreecommitdiffstats
path: root/components/guest_view
diff options
context:
space:
mode:
authorpaulmeyer <paulmeyer@chromium.org>2015-05-05 16:36:01 -0700
committerCommit bot <commit-bot@chromium.org>2015-05-05 23:36:36 +0000
commit1f8c6fa60df5582e5bcc99900d708c5f876dd4af (patch)
treecc4d5cc33762c413de2d59c166d996016169c49a /components/guest_view
parent4f5368d8975e4336e6f90b1170a46837a76cbb99 (diff)
downloadchromium_src-1f8c6fa60df5582e5bcc99900d708c5f876dd4af.zip
chromium_src-1f8c6fa60df5582e5bcc99900d708c5f876dd4af.tar.gz
chromium_src-1f8c6fa60df5582e5bcc99900d708c5f876dd4af.tar.bz2
Fixed PDF resize issue.
This patch also introduces a test for this fix, as well as some additions to the MimeHanlderView testing infrastructure to facilitate this new test. BUG=481104 Review URL: https://codereview.chromium.org/1113273007 Cr-Commit-Position: refs/heads/master@{#328435}
Diffstat (limited to 'components/guest_view')
-rw-r--r--components/guest_view/browser/guest_view_base.h2
-rw-r--r--components/guest_view/browser/guest_view_manager.h10
-rw-r--r--components/guest_view/browser/test_guest_view_manager.h8
3 files changed, 18 insertions, 2 deletions
diff --git a/components/guest_view/browser/guest_view_base.h b/components/guest_view/browser/guest_view_base.h
index 04d3f41..2f167e1 100644
--- a/components/guest_view/browser/guest_view_base.h
+++ b/components/guest_view/browser/guest_view_base.h
@@ -243,6 +243,8 @@ class GuestViewBase : public content::BrowserPluginGuestDelegate,
bool can_owner_receive_events() const { return !!view_instance_id_; }
+ gfx::Size size() const { return guest_size_; }
+
// Returns the user browser context of the embedder.
content::BrowserContext* browser_context() const { return browser_context_; }
diff --git a/components/guest_view/browser/guest_view_manager.h b/components/guest_view/browser/guest_view_manager.h
index f51d0a6..278c2cb 100644
--- a/components/guest_view/browser/guest_view_manager.h
+++ b/components/guest_view/browser/guest_view_manager.h
@@ -81,8 +81,14 @@ class GuestViewManager : public content::BrowserPluginGuestManager,
template <typename T>
void RegisterGuestViewType() {
- auto it = guest_view_registry_.find(T::Type);
- DCHECK(it == guest_view_registry_.end());
+ // If the GuestView type |T| is already registered, then there is nothing
+ // more to do. If an existing entry in the registry was created by this
+ // function for type |T|, then registering again would have no effect, and
+ // if it was registered elsewhere, then we do not want to overwrite it. Note
+ // that it is possible for tests to have special test factory methods
+ // registered here.
+ if (guest_view_registry_.count(T::Type))
+ return;
guest_view_registry_[T::Type] = base::Bind(&T::Create);
}
diff --git a/components/guest_view/browser/test_guest_view_manager.h b/components/guest_view/browser/test_guest_view_manager.h
index cbf942f..59964ef 100644
--- a/components/guest_view/browser/test_guest_view_manager.h
+++ b/components/guest_view/browser/test_guest_view_manager.h
@@ -32,6 +32,14 @@ class TestGuestViewManager : public GuestViewManager {
// Returns the size of the set of removed instance IDs.
size_t GetNumRemovedInstanceIDs() const;
+ using GuestViewCreateFunction =
+ base::Callback<GuestViewBase*(content::WebContents*)>;;
+
+ template <typename T>
+ void RegisterTestGuestViewType(GuestViewCreateFunction create_function) {
+ guest_view_registry_[T::Type] = create_function;
+ }
+
// Returns the number of guests that have been created since the creation of
// this GuestViewManager.
int num_guests_created() const { return num_guests_created_; }