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

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

Issue 1087123002: Towards Decoupling GuestView from Extensions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed lazyboy@'s comments. Removed unnecessary includes. Simplified GuestViewEvent. Created 5 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
« no previous file with comments | « no previous file | extensions/browser/guest_view/extension_options/extension_options_guest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 5
6 #include "chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.h" 6 #include "chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.h"
7 7
8 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" 8 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h"
9 #include "chrome/browser/favicon/favicon_helper.h" 9 #include "chrome/browser/favicon/favicon_helper.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h" 11 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h"
12 #include "chrome/browser/ui/pdf/chrome_pdf_web_contents_helper_client.h" 12 #include "chrome/browser/ui/pdf/chrome_pdf_web_contents_helper_client.h"
13 #include "chrome/common/chrome_version_info.h" 13 #include "chrome/common/chrome_version_info.h"
14 #include "components/browsing_data/storage_partition_http_cache_data_remover.h" 14 #include "components/browsing_data/storage_partition_http_cache_data_remover.h"
15 #include "components/pdf/browser/pdf_web_contents_helper.h" 15 #include "components/pdf/browser/pdf_web_contents_helper.h"
16 #include "components/renderer_context_menu/context_menu_delegate.h" 16 #include "components/renderer_context_menu/context_menu_delegate.h"
17 #include "components/web_cache/browser/web_cache_manager.h" 17 #include "components/web_cache/browser/web_cache_manager.h"
18 #include "content/public/browser/render_process_host.h" 18 #include "content/public/browser/render_process_host.h"
19 #include "extensions/browser/api/web_request/web_request_api.h" 19 #include "extensions/browser/api/web_request/web_request_api.h"
20 #include "extensions/browser/guest_view/guest_view_event.h"
20 #include "extensions/browser/guest_view/web_view/web_view_constants.h" 21 #include "extensions/browser/guest_view/web_view/web_view_constants.h"
21 22
22 #if defined(ENABLE_PRINTING) 23 #if defined(ENABLE_PRINTING)
23 #if defined(ENABLE_PRINT_PREVIEW) 24 #if defined(ENABLE_PRINT_PREVIEW)
24 #include "chrome/browser/printing/print_preview_message_handler.h" 25 #include "chrome/browser/printing/print_preview_message_handler.h"
25 #include "chrome/browser/printing/print_view_manager.h" 26 #include "chrome/browser/printing/print_view_manager.h"
26 #else 27 #else
27 #include "chrome/browser/printing/print_view_manager_basic.h" 28 #include "chrome/browser/printing/print_view_manager_basic.h"
28 #endif // defined(ENABLE_PRINT_PREVIEW) 29 #endif // defined(ENABLE_PRINT_PREVIEW)
29 #endif // defined(ENABLE_PRINTING) 30 #endif // defined(ENABLE_PRINTING)
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 pending_menu_ = menu_delegate->BuildMenu(guest_web_contents(), params); 73 pending_menu_ = menu_delegate->BuildMenu(guest_web_contents(), params);
73 74
74 // Pass it to embedder. 75 // Pass it to embedder.
75 int request_id = ++pending_context_menu_request_id_; 76 int request_id = ++pending_context_menu_request_id_;
76 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); 77 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
77 scoped_ptr<base::ListValue> items = 78 scoped_ptr<base::ListValue> items =
78 MenuModelToValue(pending_menu_->menu_model()); 79 MenuModelToValue(pending_menu_->menu_model());
79 args->Set(webview::kContextMenuItems, items.release()); 80 args->Set(webview::kContextMenuItems, items.release());
80 args->SetInteger(webview::kRequestId, request_id); 81 args->SetInteger(webview::kRequestId, request_id);
81 web_view_guest()->DispatchEventToView( 82 web_view_guest()->DispatchEventToView(
82 new GuestViewBase::Event(webview::kEventContextMenuShow, args.Pass())); 83 new GuestViewEvent(webview::kEventContextMenuShow, args.Pass()));
83 return true; 84 return true;
84 } 85 }
85 86
86 // TODO(hanxi) Investigate which of these observers should move to the 87 // TODO(hanxi) Investigate which of these observers should move to the
87 // extension module in the future. 88 // extension module in the future.
88 void ChromeWebViewGuestDelegate::OnAttachWebViewHelpers( 89 void ChromeWebViewGuestDelegate::OnAttachWebViewHelpers(
89 content::WebContents* contents) { 90 content::WebContents* contents) {
90 favicon::CreateContentFaviconDriverForWebContents(contents); 91 favicon::CreateContentFaviconDriverForWebContents(contents);
91 ChromeExtensionWebContentsObserver::CreateForWebContents(contents); 92 ChromeExtensionWebContentsObserver::CreateForWebContents(contents);
92 #if defined(ENABLE_PRINTING) 93 #if defined(ENABLE_PRINTING)
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 chromeos::ACCESSIBILITY_TOGGLE_SPOKEN_FEEDBACK) { 193 chromeos::ACCESSIBILITY_TOGGLE_SPOKEN_FEEDBACK) {
193 if (details.enabled) 194 if (details.enabled)
194 InjectChromeVoxIfNeeded(guest_web_contents()->GetRenderViewHost()); 195 InjectChromeVoxIfNeeded(guest_web_contents()->GetRenderViewHost());
195 else 196 else
196 chromevox_injected_ = false; 197 chromevox_injected_ = false;
197 } 198 }
198 } 199 }
199 #endif 200 #endif
200 201
201 } // namespace extensions 202 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | extensions/browser/guest_view/extension_options/extension_options_guest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698