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

Side by Side Diff: chrome/browser/guestview/webview/webview_guest.cc

Issue 232773011: Zoom Extension API (work in progress) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Took callbacks, zoom modes, and observer stuff out of content, and reimplemented similar functional… Created 6 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include "chrome/browser/guestview/webview/webview_guest.h" 5 #include "chrome/browser/guestview/webview/webview_guest.h"
6 6
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "chrome/browser/chrome_notification_types.h" 8 #include "chrome/browser/chrome_notification_types.h"
9 #include "chrome/browser/extensions/api/web_request/web_request_api.h" 9 #include "chrome/browser/extensions/api/web_request/web_request_api.h"
10 #include "chrome/browser/extensions/api/webview/webview_api.h" 10 #include "chrome/browser/extensions/api/webview/webview_api.h"
11 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" 11 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h"
12 #include "chrome/browser/extensions/extension_renderer_state.h" 12 #include "chrome/browser/extensions/extension_renderer_state.h"
13 #include "chrome/browser/extensions/menu_manager.h" 13 #include "chrome/browser/extensions/menu_manager.h"
14 #include "chrome/browser/extensions/script_executor.h" 14 #include "chrome/browser/extensions/script_executor.h"
15 #include "chrome/browser/favicon/favicon_tab_helper.h" 15 #include "chrome/browser/favicon/favicon_tab_helper.h"
16 #include "chrome/browser/guestview/guestview_constants.h" 16 #include "chrome/browser/guestview/guestview_constants.h"
17 #include "chrome/browser/guestview/webview/webview_constants.h" 17 #include "chrome/browser/guestview/webview/webview_constants.h"
18 #include "chrome/browser/guestview/webview/webview_permission_types.h" 18 #include "chrome/browser/guestview/webview/webview_permission_types.h"
19 #include "chrome/browser/ui/zoom/zoom_controller.h"
19 #include "chrome/common/chrome_version_info.h" 20 #include "chrome/common/chrome_version_info.h"
20 #include "content/public/browser/browser_thread.h" 21 #include "content/public/browser/browser_thread.h"
21 #include "content/public/browser/native_web_keyboard_event.h" 22 #include "content/public/browser/native_web_keyboard_event.h"
22 #include "content/public/browser/navigation_entry.h" 23 #include "content/public/browser/navigation_entry.h"
23 #include "content/public/browser/notification_details.h" 24 #include "content/public/browser/notification_details.h"
24 #include "content/public/browser/notification_service.h" 25 #include "content/public/browser/notification_service.h"
25 #include "content/public/browser/notification_source.h" 26 #include "content/public/browser/notification_source.h"
26 #include "content/public/browser/notification_types.h" 27 #include "content/public/browser/notification_types.h"
27 #include "content/public/browser/render_process_host.h" 28 #include "content/public/browser/render_process_host.h"
28 #include "content/public/browser/resource_request_details.h" 29 #include "content/public/browser/resource_request_details.h"
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 is_top_level); 500 is_top_level);
500 break; 501 break;
501 } 502 }
502 default: 503 default:
503 NOTREACHED() << "Unexpected notification sent."; 504 NOTREACHED() << "Unexpected notification sent.";
504 break; 505 break;
505 } 506 }
506 } 507 }
507 508
508 void WebViewGuest::SetZoom(double zoom_factor) { 509 void WebViewGuest::SetZoom(double zoom_factor) {
510 ZoomController* zoom_controller =
511 ZoomController::FromWebContents(guest_web_contents());
509 double zoom_level = content::ZoomFactorToZoomLevel(zoom_factor); 512 double zoom_level = content::ZoomFactorToZoomLevel(zoom_factor);
510 guest_web_contents()->SetZoomLevel(zoom_level); 513 zoom_controller->SetZoomLevel(zoom_level);
511 514
512 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); 515 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
513 args->SetDouble(webview::kOldZoomFactor, current_zoom_factor_); 516 args->SetDouble(webview::kOldZoomFactor, current_zoom_factor_);
514 args->SetDouble(webview::kNewZoomFactor, zoom_factor); 517 args->SetDouble(webview::kNewZoomFactor, zoom_factor);
515 DispatchEvent(new GuestView::Event(webview::kEventZoomChange, args.Pass())); 518 DispatchEvent(new GuestView::Event(webview::kEventZoomChange, args.Pass()));
516 519
517 current_zoom_factor_ = zoom_factor; 520 current_zoom_factor_ = zoom_factor;
518 } 521 }
519 522
520 double WebViewGuest::GetZoom() { 523 double WebViewGuest::GetZoom() {
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 const PermissionResponseCallback& callback, 830 const PermissionResponseCallback& callback,
828 BrowserPluginPermissionType permission_type, 831 BrowserPluginPermissionType permission_type,
829 bool allowed_by_default) 832 bool allowed_by_default)
830 : callback(callback), 833 : callback(callback),
831 permission_type(permission_type), 834 permission_type(permission_type),
832 allowed_by_default(allowed_by_default) { 835 allowed_by_default(allowed_by_default) {
833 } 836 }
834 837
835 WebViewGuest::PermissionResponseInfo::~PermissionResponseInfo() { 838 WebViewGuest::PermissionResponseInfo::~PermissionResponseInfo() {
836 } 839 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/tabs/tabs_test.cc ('k') | chrome/browser/ui/views/location_bar/zoom_bubble_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698