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 #ifndef EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ | 5 #ifndef EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ |
6 #define EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ | 6 #define EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 | 9 |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 void SendQueuedEvents(); | 333 void SendQueuedEvents(); |
334 | 334 |
335 void CompleteInit(scoped_ptr<base::DictionaryValue> create_params, | 335 void CompleteInit(scoped_ptr<base::DictionaryValue> create_params, |
336 const WebContentsCreatedCallback& callback, | 336 const WebContentsCreatedCallback& callback, |
337 content::WebContents* guest_web_contents); | 337 content::WebContents* guest_web_contents); |
338 | 338 |
339 // Dispatches the onResize event to the embedder. | 339 // Dispatches the onResize event to the embedder. |
340 void DispatchOnResizeEvent(const gfx::Size& old_size, | 340 void DispatchOnResizeEvent(const gfx::Size& old_size, |
341 const gfx::Size& new_size); | 341 const gfx::Size& new_size); |
342 | 342 |
| 343 // Get the zoom factor for the embedder's web contents. |
| 344 double GetEmbedderZoomFactor(); |
| 345 |
| 346 // Convert sizes in pixels from logical to physical numbers of pixels. |
| 347 // Note that a size can consist of a fractional number of logical pixels |
| 348 // (hence |logical_pixels| is represented as a double), but will always |
| 349 // consist of an integral number of physical pixels (hence the return value |
| 350 // is represented as an int). |
| 351 int LogicalPixelsToPhysicalPixels(double logical_pixels); |
| 352 |
| 353 // Convert sizes in pixels from physical to logical numbers of pixels. |
| 354 // Note that a size can consist of a fractional number of logical pixels |
| 355 // (hence the return value is represented as a double), but will always |
| 356 // consist of an integral number of physical pixels (hence |physical_pixels| |
| 357 // is represented as an int). |
| 358 double PhysicalPixelsToLogicalPixels(int physical_pixels); |
| 359 |
343 void SetUpSizing(const base::DictionaryValue& params); | 360 void SetUpSizing(const base::DictionaryValue& params); |
344 | 361 |
345 void StartTrackingEmbedderZoomLevel(); | 362 void StartTrackingEmbedderZoomLevel(); |
346 void StopTrackingEmbedderZoomLevel(); | 363 void StopTrackingEmbedderZoomLevel(); |
347 | 364 |
348 static void RegisterGuestViewTypes(); | 365 static void RegisterGuestViewTypes(); |
349 | 366 |
350 // This guest tracks the lifetime of the WebContents specified by | 367 // This guest tracks the lifetime of the WebContents specified by |
351 // |owner_web_contents_|. If |owner_web_contents_| is destroyed then this | 368 // |owner_web_contents_|. If |owner_web_contents_| is destroyed then this |
352 // guest will also self-destruct. | 369 // guest will also self-destruct. |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 // This is used to ensure pending tasks will not fire after this object is | 438 // This is used to ensure pending tasks will not fire after this object is |
422 // destroyed. | 439 // destroyed. |
423 base::WeakPtrFactory<GuestViewBase> weak_ptr_factory_; | 440 base::WeakPtrFactory<GuestViewBase> weak_ptr_factory_; |
424 | 441 |
425 DISALLOW_COPY_AND_ASSIGN(GuestViewBase); | 442 DISALLOW_COPY_AND_ASSIGN(GuestViewBase); |
426 }; | 443 }; |
427 | 444 |
428 } // namespace extensions | 445 } // namespace extensions |
429 | 446 |
430 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ | 447 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ |
OLD | NEW |