Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(358)

Side by Side Diff: extensions/browser/guest_view/guest_view_base.h

Issue 934303003: Fixed the bug that caused extension options not to fit their overlays properly when zoomed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 void DispatchEventToGuestProxy(Event* event); 286 void DispatchEventToGuestProxy(Event* event);
287 287
288 // Dispatches an event to the view. 288 // Dispatches an event to the view.
289 void DispatchEventToView(Event* event); 289 void DispatchEventToView(Event* event);
290 290
291 protected: 291 protected:
292 explicit GuestViewBase(content::WebContents* owner_web_contents); 292 explicit GuestViewBase(content::WebContents* owner_web_contents);
293 293
294 ~GuestViewBase() override; 294 ~GuestViewBase() override;
295 295
296 // Convert sizes in pixels from logical to physical numbers of pixels.
297 // Note that a size can consist of a fractional number of logical pixels
298 // (hence |logical_pixels| is represented as a double), but will always
299 // consist of an integral number of physical pixels (hence the return value
300 // is represented as an int).
301 int LogicalPixelsToPhysicalPixels(double logical_pixels);
302
303 // Convert sizes in pixels from physical to logical numbers of pixels.
304 // Note that a size can consist of a fractional number of logical pixels
305 // (hence the return value is represented as a double), but will always
306 // consist of an integral number of physical pixels (hence |physical_pixels|
307 // is represented as an int).
308 double PhysicalPixelsToLogicalPixels(int physical_pixels);
309
296 // WebContentsObserver implementation. 310 // WebContentsObserver implementation.
297 void DidStopLoading(content::RenderViewHost* render_view_host) final; 311 void DidStopLoading(content::RenderViewHost* render_view_host) final;
298 void RenderViewReady() final; 312 void RenderViewReady() final;
299 void WebContentsDestroyed() final; 313 void WebContentsDestroyed() final;
300 314
301 // WebContentsDelegate implementation. 315 // WebContentsDelegate implementation.
302 void ActivateContents(content::WebContents* contents) final; 316 void ActivateContents(content::WebContents* contents) final;
303 void DeactivateContents(content::WebContents* contents) final; 317 void DeactivateContents(content::WebContents* contents) final;
304 void ContentsMouseEvent(content::WebContents* source, 318 void ContentsMouseEvent(content::WebContents* source,
305 const gfx::Point& location, 319 const gfx::Point& location,
(...skipping 30 matching lines...) Expand all
336 const WebContentsCreatedCallback& callback, 350 const WebContentsCreatedCallback& callback,
337 content::WebContents* guest_web_contents); 351 content::WebContents* guest_web_contents);
338 352
339 // Dispatches the onResize event to the embedder. 353 // Dispatches the onResize event to the embedder.
340 void DispatchOnResizeEvent(const gfx::Size& old_size, 354 void DispatchOnResizeEvent(const gfx::Size& old_size,
341 const gfx::Size& new_size); 355 const gfx::Size& new_size);
342 356
343 // Get the zoom factor for the embedder's web contents. 357 // Get the zoom factor for the embedder's web contents.
344 double GetEmbedderZoomFactor(); 358 double GetEmbedderZoomFactor();
345 359
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
360 void SetUpSizing(const base::DictionaryValue& params); 360 void SetUpSizing(const base::DictionaryValue& params);
361 361
362 void StartTrackingEmbedderZoomLevel(); 362 void StartTrackingEmbedderZoomLevel();
363 void StopTrackingEmbedderZoomLevel(); 363 void StopTrackingEmbedderZoomLevel();
364 364
365 static void RegisterGuestViewTypes(); 365 static void RegisterGuestViewTypes();
366 366
367 // This guest tracks the lifetime of the WebContents specified by 367 // This guest tracks the lifetime of the WebContents specified by
368 // |owner_web_contents_|. If |owner_web_contents_| is destroyed then this 368 // |owner_web_contents_|. If |owner_web_contents_| is destroyed then this
369 // guest will also self-destruct. 369 // guest will also self-destruct.
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 // 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
439 // destroyed. 439 // destroyed.
440 base::WeakPtrFactory<GuestViewBase> weak_ptr_factory_; 440 base::WeakPtrFactory<GuestViewBase> weak_ptr_factory_;
441 441
442 DISALLOW_COPY_AND_ASSIGN(GuestViewBase); 442 DISALLOW_COPY_AND_ASSIGN(GuestViewBase);
443 }; 443 };
444 444
445 } // namespace extensions 445 } // namespace extensions
446 446
447 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ 447 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698