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

Side by Side Diff: chrome/renderer/render_view.cc

Issue 5639004: Implement a useful context menu for the blocked plug-in frame:... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years 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
« no previous file with comments | « chrome/renderer/render_view.h ('k') | webkit/glue/plugins/webview_plugin.h » ('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 (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/renderer/render_view.h" 5 #include "chrome/renderer/render_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 ALLOW_THIS_IN_INITIALIZER_LIST(page_info_method_factory_(this)), 510 ALLOW_THIS_IN_INITIALIZER_LIST(page_info_method_factory_(this)),
511 ALLOW_THIS_IN_INITIALIZER_LIST(autofill_method_factory_(this)), 511 ALLOW_THIS_IN_INITIALIZER_LIST(autofill_method_factory_(this)),
512 ALLOW_THIS_IN_INITIALIZER_LIST(accessibility_method_factory_(this)), 512 ALLOW_THIS_IN_INITIALIZER_LIST(accessibility_method_factory_(this)),
513 ALLOW_THIS_IN_INITIALIZER_LIST(translate_helper_(this)), 513 ALLOW_THIS_IN_INITIALIZER_LIST(translate_helper_(this)),
514 ALLOW_THIS_IN_INITIALIZER_LIST(cookie_jar_(this)), 514 ALLOW_THIS_IN_INITIALIZER_LIST(cookie_jar_(this)),
515 ALLOW_THIS_IN_INITIALIZER_LIST( 515 ALLOW_THIS_IN_INITIALIZER_LIST(
516 notification_provider_(new NotificationProvider(this))), 516 notification_provider_(new NotificationProvider(this))),
517 accessibility_ack_pending_(false), 517 accessibility_ack_pending_(false),
518 pending_app_icon_requests_(0), 518 pending_app_icon_requests_(0),
519 session_storage_namespace_id_(session_storage_namespace_id), 519 session_storage_namespace_id_(session_storage_namespace_id),
520 decrement_shared_popup_at_destruction_(false) { 520 decrement_shared_popup_at_destruction_(false),
521 custom_menu_listener_(NULL) {
521 #if defined(OS_MACOSX) 522 #if defined(OS_MACOSX)
522 // On Mac, the select popups are rendered by the browser. 523 // On Mac, the select popups are rendered by the browser.
523 // Note that we don't do this in RenderMain otherwise this would not be called 524 // Note that we don't do this in RenderMain otherwise this would not be called
524 // in single-process mode. 525 // in single-process mode.
525 WebKit::WebView::setUseExternalPopupMenus(true); 526 WebKit::WebView::setUseExternalPopupMenus(true);
526 #endif 527 #endif
527 password_autocomplete_manager_.reset(new PasswordAutocompleteManager(this)); 528 password_autocomplete_manager_.reset(new PasswordAutocompleteManager(this));
528 autofill_helper_.reset(new AutoFillHelper(this)); 529 autofill_helper_.reset(new AutoFillHelper(this));
529 page_click_tracker_.reset(new PageClickTracker(this)); 530 page_click_tracker_.reset(new PageClickTracker(this));
530 // Note that the order of insertion of the listeners is important. 531 // Note that the order of insertion of the listeners is important.
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
800 if (!found || !info.enabled) 801 if (!found || !info.enabled)
801 return NULL; 802 return NULL;
802 scoped_refptr<pepper::PluginModule> pepper_module( 803 scoped_refptr<pepper::PluginModule> pepper_module(
803 PepperPluginRegistry::GetInstance()->GetModule(info.path)); 804 PepperPluginRegistry::GetInstance()->GetModule(info.path));
804 if (pepper_module) 805 if (pepper_module)
805 return CreatePepperPlugin(frame, params, info.path, pepper_module.get()); 806 return CreatePepperPlugin(frame, params, info.path, pepper_module.get());
806 else 807 else
807 return CreateNPAPIPlugin(frame, params, info.path, mime_type); 808 return CreateNPAPIPlugin(frame, params, info.path, mime_type);
808 } 809 }
809 810
811 void RenderView::CustomMenuListenerInstall(CustomMenuListener* listening) {
812 custom_menu_listener_ = listening;
813 }
814
815 void RenderView::CustomMenuListenerDestroyed(CustomMenuListener* dead) {
816 if (custom_menu_listener_ == dead)
817 custom_menu_listener_ = NULL;
818 }
819
810 void RenderView::RegisterPluginDelegate(WebPluginDelegateProxy* delegate) { 820 void RenderView::RegisterPluginDelegate(WebPluginDelegateProxy* delegate) {
811 plugin_delegates_.insert(delegate); 821 plugin_delegates_.insert(delegate);
812 // If the renderer is visible, set initial visibility and focus state. 822 // If the renderer is visible, set initial visibility and focus state.
813 if (!is_hidden()) { 823 if (!is_hidden()) {
814 #if defined(OS_MACOSX) 824 #if defined(OS_MACOSX)
815 delegate->SetContainerVisibility(true); 825 delegate->SetContainerVisibility(true);
816 if (webview() && webview()->isActive()) 826 if (webview() && webview()->isActive())
817 delegate->SetWindowFocus(true); 827 delegate->SetWindowFocus(true);
818 #endif 828 #endif
819 } 829 }
(...skipping 1564 matching lines...) Expand 10 before | Expand all | Expand 10 after
2384 // response as RunJavaScriptMessage. 2394 // response as RunJavaScriptMessage.
2385 std::wstring ignored_result; 2395 std::wstring ignored_result;
2386 SendAndRunNestedMessageLoop(new ViewHostMsg_RunBeforeUnloadConfirm( 2396 SendAndRunNestedMessageLoop(new ViewHostMsg_RunBeforeUnloadConfirm(
2387 routing_id_, frame->url(), UTF16ToWideHack(message), &success, 2397 routing_id_, frame->url(), UTF16ToWideHack(message), &success,
2388 &ignored_result)); 2398 &ignored_result));
2389 return success; 2399 return success;
2390 } 2400 }
2391 2401
2392 void RenderView::showContextMenu( 2402 void RenderView::showContextMenu(
2393 WebFrame* frame, const WebContextMenuData& data) { 2403 WebFrame* frame, const WebContextMenuData& data) {
2404 custom_menu_listener_ = NULL;
2394 ContextMenuParams params = ContextMenuParams(data); 2405 ContextMenuParams params = ContextMenuParams(data);
2395 if (!params.misspelled_word.empty() && RenderThread::current()) { 2406 if (!params.misspelled_word.empty() && RenderThread::current()) {
2396 int misspelled_offset, misspelled_length; 2407 int misspelled_offset, misspelled_length;
2397 bool spelled_right = RenderThread::current()->spellchecker()-> 2408 bool spelled_right = RenderThread::current()->spellchecker()->
2398 SpellCheckWord( 2409 SpellCheckWord(
2399 params.misspelled_word.c_str(), params.misspelled_word.size(), 2410 params.misspelled_word.c_str(), params.misspelled_word.size(),
2400 document_tag_, 2411 document_tag_,
2401 &misspelled_offset, &misspelled_length, 2412 &misspelled_offset, &misspelled_length,
2402 &params.dictionary_suggestions); 2413 &params.dictionary_suggestions);
2403 if (spelled_right) 2414 if (spelled_right)
(...skipping 2279 matching lines...) Expand 10 before | Expand all | Expand 10 after
4683 void RenderView::OnUpdateWebPreferences(const WebPreferences& prefs) { 4694 void RenderView::OnUpdateWebPreferences(const WebPreferences& prefs) {
4684 webkit_preferences_ = prefs; 4695 webkit_preferences_ = prefs;
4685 webkit_preferences_.Apply(webview()); 4696 webkit_preferences_.Apply(webview());
4686 } 4697 }
4687 4698
4688 void RenderView::OnSetAltErrorPageURL(const GURL& url) { 4699 void RenderView::OnSetAltErrorPageURL(const GURL& url) {
4689 alternate_error_page_url_ = url; 4700 alternate_error_page_url_ = url;
4690 } 4701 }
4691 4702
4692 void RenderView::OnCustomContextMenuAction(unsigned action) { 4703 void RenderView::OnCustomContextMenuAction(unsigned action) {
4693 webview()->performCustomContextMenuAction(action); 4704 if (custom_menu_listener_)
4705 custom_menu_listener_->MenuItemSelected(action);
4706 else
4707 webview()->performCustomContextMenuAction(action);
4694 } 4708 }
4695 4709
4696 void RenderView::OnTranslatePage(int page_id, 4710 void RenderView::OnTranslatePage(int page_id,
4697 const std::string& translate_script, 4711 const std::string& translate_script,
4698 const std::string& source_lang, 4712 const std::string& source_lang,
4699 const std::string& target_lang) { 4713 const std::string& target_lang) {
4700 translate_helper_.TranslatePage(page_id, source_lang, target_lang, 4714 translate_helper_.TranslatePage(page_id, source_lang, target_lang,
4701 translate_script); 4715 translate_script);
4702 } 4716 }
4703 4717
(...skipping 981 matching lines...) Expand 10 before | Expand all | Expand 10 after
5685 external_popup_menu_.reset(); 5699 external_popup_menu_.reset();
5686 } 5700 }
5687 #endif 5701 #endif
5688 5702
5689 void RenderView::AddErrorToRootConsole(const string16& message) { 5703 void RenderView::AddErrorToRootConsole(const string16& message) {
5690 if (webview() && webview()->mainFrame()) { 5704 if (webview() && webview()->mainFrame()) {
5691 webview()->mainFrame()->addMessageToConsole( 5705 webview()->mainFrame()->addMessageToConsole(
5692 WebConsoleMessage(WebConsoleMessage::LevelError, message)); 5706 WebConsoleMessage(WebConsoleMessage::LevelError, message));
5693 } 5707 }
5694 } 5708 }
OLDNEW
« no previous file with comments | « chrome/renderer/render_view.h ('k') | webkit/glue/plugins/webview_plugin.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698