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

Side by Side Diff: chrome/browser/guest_view/web_view/web_view_guest.cc

Issue 287093002: Remove ViewMsg_SetZoomLevel (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Revised as per comments. Created 6 years, 6 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 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 #include "chrome/browser/guest_view/web_view/web_view_guest.h" 5 #include "chrome/browser/guest_view/web_view/web_view_guest.h"
6 6
7 #include "base/debug/stack_trace.h" 7 #include "base/debug/stack_trace.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "chrome/browser/chrome_notification_types.h" 11 #include "chrome/browser/chrome_notification_types.h"
12 #include "chrome/browser/extensions/api/web_request/web_request_api.h" 12 #include "chrome/browser/extensions/api/web_request/web_request_api.h"
13 #include "chrome/browser/extensions/api/webview/webview_api.h" 13 #include "chrome/browser/extensions/api/webview/webview_api.h"
14 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" 14 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h"
15 #include "chrome/browser/extensions/extension_renderer_state.h" 15 #include "chrome/browser/extensions/extension_renderer_state.h"
16 #include "chrome/browser/extensions/menu_manager.h" 16 #include "chrome/browser/extensions/menu_manager.h"
17 #include "chrome/browser/extensions/script_executor.h" 17 #include "chrome/browser/extensions/script_executor.h"
18 #include "chrome/browser/favicon/favicon_tab_helper.h" 18 #include "chrome/browser/favicon/favicon_tab_helper.h"
19 #include "chrome/browser/guest_view/guest_view_constants.h" 19 #include "chrome/browser/guest_view/guest_view_constants.h"
20 #include "chrome/browser/guest_view/guest_view_manager.h" 20 #include "chrome/browser/guest_view/guest_view_manager.h"
21 #include "chrome/browser/guest_view/web_view/web_view_constants.h" 21 #include "chrome/browser/guest_view/web_view/web_view_constants.h"
22 #include "chrome/browser/guest_view/web_view/web_view_permission_types.h" 22 #include "chrome/browser/guest_view/web_view/web_view_permission_types.h"
23 #include "chrome/browser/renderer_context_menu/context_menu_delegate.h" 23 #include "chrome/browser/renderer_context_menu/context_menu_delegate.h"
24 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h" 24 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h"
25 #include "chrome/common/chrome_version_info.h" 25 #include "chrome/common/chrome_version_info.h"
26 #include "chrome/common/render_messages.h" 26 #include "chrome/common/render_messages.h"
27 #include "content/public/browser/browser_thread.h" 27 #include "content/public/browser/browser_thread.h"
28 #include "content/public/browser/child_process_security_policy.h" 28 #include "content/public/browser/child_process_security_policy.h"
29 #include "content/public/browser/geolocation_permission_context.h" 29 #include "content/public/browser/geolocation_permission_context.h"
30 #include "content/public/browser/host_zoom_map.h"
30 #include "content/public/browser/native_web_keyboard_event.h" 31 #include "content/public/browser/native_web_keyboard_event.h"
31 #include "content/public/browser/navigation_entry.h" 32 #include "content/public/browser/navigation_entry.h"
32 #include "content/public/browser/notification_details.h" 33 #include "content/public/browser/notification_details.h"
33 #include "content/public/browser/notification_service.h" 34 #include "content/public/browser/notification_service.h"
34 #include "content/public/browser/notification_source.h" 35 #include "content/public/browser/notification_source.h"
35 #include "content/public/browser/notification_types.h" 36 #include "content/public/browser/notification_types.h"
36 #include "content/public/browser/render_process_host.h" 37 #include "content/public/browser/render_process_host.h"
37 #include "content/public/browser/resource_request_details.h" 38 #include "content/public/browser/resource_request_details.h"
38 #include "content/public/browser/site_instance.h" 39 #include "content/public/browser/site_instance.h"
39 #include "content/public/browser/storage_partition.h" 40 #include "content/public/browser/storage_partition.h"
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 break; 572 break;
572 } 573 }
573 default: 574 default:
574 NOTREACHED() << "Unexpected notification sent."; 575 NOTREACHED() << "Unexpected notification sent.";
575 break; 576 break;
576 } 577 }
577 } 578 }
578 579
579 void WebViewGuest::SetZoom(double zoom_factor) { 580 void WebViewGuest::SetZoom(double zoom_factor) {
580 double zoom_level = content::ZoomFactorToZoomLevel(zoom_factor); 581 double zoom_level = content::ZoomFactorToZoomLevel(zoom_factor);
581 guest_web_contents()->SetZoomLevel(zoom_level); 582 content::HostZoomMap::SetZoomLevel(guest_web_contents(), zoom_level);
582 583
583 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); 584 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
584 args->SetDouble(webview::kOldZoomFactor, current_zoom_factor_); 585 args->SetDouble(webview::kOldZoomFactor, current_zoom_factor_);
585 args->SetDouble(webview::kNewZoomFactor, zoom_factor); 586 args->SetDouble(webview::kNewZoomFactor, zoom_factor);
586 DispatchEvent( 587 DispatchEvent(
587 new GuestViewBase::Event(webview::kEventZoomChange, args.Pass())); 588 new GuestViewBase::Event(webview::kEventZoomChange, args.Pass()));
588 589
589 current_zoom_factor_ = zoom_factor; 590 current_zoom_factor_ = zoom_factor;
590 } 591 }
591 592
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 guest_web_contents()->GetController().GetCurrentEntryIndex()); 807 guest_web_contents()->GetController().GetCurrentEntryIndex());
807 args->SetInteger(webview::kInternalEntryCount, 808 args->SetInteger(webview::kInternalEntryCount,
808 guest_web_contents()->GetController().GetEntryCount()); 809 guest_web_contents()->GetController().GetEntryCount());
809 args->SetInteger(webview::kInternalProcessId, 810 args->SetInteger(webview::kInternalProcessId,
810 guest_web_contents()->GetRenderProcessHost()->GetID()); 811 guest_web_contents()->GetRenderProcessHost()->GetID());
811 DispatchEvent( 812 DispatchEvent(
812 new GuestViewBase::Event(webview::kEventLoadCommit, args.Pass())); 813 new GuestViewBase::Event(webview::kEventLoadCommit, args.Pass()));
813 814
814 // Update the current zoom factor for the new page. 815 // Update the current zoom factor for the new page.
815 current_zoom_factor_ = content::ZoomLevelToZoomFactor( 816 current_zoom_factor_ = content::ZoomLevelToZoomFactor(
816 guest_web_contents()->GetZoomLevel()); 817 content::HostZoomMap::GetZoomLevel(guest_web_contents()));
817 818
818 if (is_main_frame) { 819 if (is_main_frame) {
819 chromevox_injected_ = false; 820 chromevox_injected_ = false;
820 main_frame_id_ = frame_id; 821 main_frame_id_ = frame_id;
821 } 822 }
822 } 823 }
823 824
824 void WebViewGuest::DidFailProvisionalLoad( 825 void WebViewGuest::DidFailProvisionalLoad(
825 int64 frame_id, 826 int64 frame_id,
826 const base::string16& frame_unique_name, 827 const base::string16& frame_unique_name,
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
1404 bool allow, 1405 bool allow,
1405 const std::string& user_input) { 1406 const std::string& user_input) {
1406 WebViewGuest* guest = 1407 WebViewGuest* guest =
1407 WebViewGuest::From(embedder_render_process_id(), new_window_instance_id); 1408 WebViewGuest::From(embedder_render_process_id(), new_window_instance_id);
1408 if (!guest) 1409 if (!guest)
1409 return; 1410 return;
1410 1411
1411 if (!allow) 1412 if (!allow)
1412 guest->Destroy(); 1413 guest->Destroy();
1413 } 1414 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698