| 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 | 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 Loading... |
| 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(web_view_guest(), |
| 84 webview::kEventContextMenuShow, |
| 85 args.Pass())); |
| 83 return true; | 86 return true; |
| 84 } | 87 } |
| 85 | 88 |
| 86 // TODO(hanxi) Investigate which of these observers should move to the | 89 // TODO(hanxi) Investigate which of these observers should move to the |
| 87 // extension module in the future. | 90 // extension module in the future. |
| 88 void ChromeWebViewGuestDelegate::OnAttachWebViewHelpers( | 91 void ChromeWebViewGuestDelegate::OnAttachWebViewHelpers( |
| 89 content::WebContents* contents) { | 92 content::WebContents* contents) { |
| 90 favicon::CreateContentFaviconDriverForWebContents(contents); | 93 favicon::CreateContentFaviconDriverForWebContents(contents); |
| 91 ChromeExtensionWebContentsObserver::CreateForWebContents(contents); | 94 ChromeExtensionWebContentsObserver::CreateForWebContents(contents); |
| 92 #if defined(ENABLE_PRINTING) | 95 #if defined(ENABLE_PRINTING) |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 chromeos::ACCESSIBILITY_TOGGLE_SPOKEN_FEEDBACK) { | 195 chromeos::ACCESSIBILITY_TOGGLE_SPOKEN_FEEDBACK) { |
| 193 if (details.enabled) | 196 if (details.enabled) |
| 194 InjectChromeVoxIfNeeded(guest_web_contents()->GetRenderViewHost()); | 197 InjectChromeVoxIfNeeded(guest_web_contents()->GetRenderViewHost()); |
| 195 else | 198 else |
| 196 chromevox_injected_ = false; | 199 chromevox_injected_ = false; |
| 197 } | 200 } |
| 198 } | 201 } |
| 199 #endif | 202 #endif |
| 200 | 203 |
| 201 } // namespace extensions | 204 } // namespace extensions |
| OLD | NEW |