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

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
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 plugin_menu_event_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::PluginMenuEventListenerInstall(BlockedPlugin* listening) {
812 plugin_menu_event_listener_ = listening;
813 }
814
815 void RenderView::PluginMenuEventListenerDestroyed(BlockedPlugin* dead) {
816 if (plugin_menu_event_listener_ == dead) {
brettw 2010/12/07 06:23:56 Don't use {} for single-line conditionals to match
Chris Evans 2010/12/07 15:36:14 Done.
817 plugin_menu_event_listener_ = NULL;
818 }
819 }
820
810 void RenderView::RegisterPluginDelegate(WebPluginDelegateProxy* delegate) { 821 void RenderView::RegisterPluginDelegate(WebPluginDelegateProxy* delegate) {
811 plugin_delegates_.insert(delegate); 822 plugin_delegates_.insert(delegate);
812 // If the renderer is visible, set initial visibility and focus state. 823 // If the renderer is visible, set initial visibility and focus state.
813 if (!is_hidden()) { 824 if (!is_hidden()) {
814 #if defined(OS_MACOSX) 825 #if defined(OS_MACOSX)
815 delegate->SetContainerVisibility(true); 826 delegate->SetContainerVisibility(true);
816 if (webview() && webview()->isActive()) 827 if (webview() && webview()->isActive())
817 delegate->SetWindowFocus(true); 828 delegate->SetWindowFocus(true);
818 #endif 829 #endif
819 } 830 }
(...skipping 1564 matching lines...) Expand 10 before | Expand all | Expand 10 after
2384 // response as RunJavaScriptMessage. 2395 // response as RunJavaScriptMessage.
2385 std::wstring ignored_result; 2396 std::wstring ignored_result;
2386 SendAndRunNestedMessageLoop(new ViewHostMsg_RunBeforeUnloadConfirm( 2397 SendAndRunNestedMessageLoop(new ViewHostMsg_RunBeforeUnloadConfirm(
2387 routing_id_, frame->url(), UTF16ToWideHack(message), &success, 2398 routing_id_, frame->url(), UTF16ToWideHack(message), &success,
2388 &ignored_result)); 2399 &ignored_result));
2389 return success; 2400 return success;
2390 } 2401 }
2391 2402
2392 void RenderView::showContextMenu( 2403 void RenderView::showContextMenu(
2393 WebFrame* frame, const WebContextMenuData& data) { 2404 WebFrame* frame, const WebContextMenuData& data) {
2405 plugin_menu_event_listener_ = NULL;
2394 ContextMenuParams params = ContextMenuParams(data); 2406 ContextMenuParams params = ContextMenuParams(data);
2395 if (!params.misspelled_word.empty() && RenderThread::current()) { 2407 if (!params.misspelled_word.empty() && RenderThread::current()) {
2396 int misspelled_offset, misspelled_length; 2408 int misspelled_offset, misspelled_length;
2397 bool spelled_right = RenderThread::current()->spellchecker()-> 2409 bool spelled_right = RenderThread::current()->spellchecker()->
2398 SpellCheckWord( 2410 SpellCheckWord(
2399 params.misspelled_word.c_str(), params.misspelled_word.size(), 2411 params.misspelled_word.c_str(), params.misspelled_word.size(),
2400 document_tag_, 2412 document_tag_,
2401 &misspelled_offset, &misspelled_length, 2413 &misspelled_offset, &misspelled_length,
2402 &params.dictionary_suggestions); 2414 &params.dictionary_suggestions);
2403 if (spelled_right) 2415 if (spelled_right)
(...skipping 2279 matching lines...) Expand 10 before | Expand all | Expand 10 after
4683 void RenderView::OnUpdateWebPreferences(const WebPreferences& prefs) { 4695 void RenderView::OnUpdateWebPreferences(const WebPreferences& prefs) {
4684 webkit_preferences_ = prefs; 4696 webkit_preferences_ = prefs;
4685 webkit_preferences_.Apply(webview()); 4697 webkit_preferences_.Apply(webview());
4686 } 4698 }
4687 4699
4688 void RenderView::OnSetAltErrorPageURL(const GURL& url) { 4700 void RenderView::OnSetAltErrorPageURL(const GURL& url) {
4689 alternate_error_page_url_ = url; 4701 alternate_error_page_url_ = url;
4690 } 4702 }
4691 4703
4692 void RenderView::OnCustomContextMenuAction(unsigned action) { 4704 void RenderView::OnCustomContextMenuAction(unsigned action) {
4693 webview()->performCustomContextMenuAction(action); 4705 if (plugin_menu_event_listener_) {
4706 plugin_menu_event_listener_->menuOptionSelected(action);
4707 } else {
4708 webview()->performCustomContextMenuAction(action);
4709 }
4694 } 4710 }
4695 4711
4696 void RenderView::OnTranslatePage(int page_id, 4712 void RenderView::OnTranslatePage(int page_id,
4697 const std::string& translate_script, 4713 const std::string& translate_script,
4698 const std::string& source_lang, 4714 const std::string& source_lang,
4699 const std::string& target_lang) { 4715 const std::string& target_lang) {
4700 translate_helper_.TranslatePage(page_id, source_lang, target_lang, 4716 translate_helper_.TranslatePage(page_id, source_lang, target_lang,
4701 translate_script); 4717 translate_script);
4702 } 4718 }
4703 4719
(...skipping 981 matching lines...) Expand 10 before | Expand all | Expand 10 after
5685 external_popup_menu_.reset(); 5701 external_popup_menu_.reset();
5686 } 5702 }
5687 #endif 5703 #endif
5688 5704
5689 void RenderView::AddErrorToRootConsole(const string16& message) { 5705 void RenderView::AddErrorToRootConsole(const string16& message) {
5690 if (webview() && webview()->mainFrame()) { 5706 if (webview() && webview()->mainFrame()) {
5691 webview()->mainFrame()->addMessageToConsole( 5707 webview()->mainFrame()->addMessageToConsole(
5692 WebConsoleMessage(WebConsoleMessage::LevelError, message)); 5708 WebConsoleMessage(WebConsoleMessage::LevelError, message));
5693 } 5709 }
5694 } 5710 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698