| 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 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h" | 5 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 this, | 561 this, |
| 562 &menu_model_, | 562 &menu_model_, |
| 563 base::Bind(MenuItemMatchesParams, params_)), | 563 base::Bind(MenuItemMatchesParams, params_)), |
| 564 profile_link_submenu_model_(this), | 564 profile_link_submenu_model_(this), |
| 565 multiple_profiles_open_(false), | 565 multiple_profiles_open_(false), |
| 566 protocol_handler_submenu_model_(this), | 566 protocol_handler_submenu_model_(this), |
| 567 protocol_handler_registry_( | 567 protocol_handler_registry_( |
| 568 ProtocolHandlerRegistryFactory::GetForBrowserContext(GetProfile())), | 568 ProtocolHandlerRegistryFactory::GetForBrowserContext(GetProfile())), |
| 569 save_as_text_experiement_enabled_(false), | 569 save_as_text_experiement_enabled_(false), |
| 570 embedder_web_contents_(GetWebContentsToUse(source_web_contents_)) { | 570 embedder_web_contents_(GetWebContentsToUse(source_web_contents_)) { |
| 571 LOG(ERROR) << "ContextMenu: rfh:" << render_frame_host; |
| 571 if (!g_custom_id_ranges_initialized) { | 572 if (!g_custom_id_ranges_initialized) { |
| 572 g_custom_id_ranges_initialized = true; | 573 g_custom_id_ranges_initialized = true; |
| 573 SetContentCustomCommandIdRange(IDC_CONTENT_CONTEXT_CUSTOM_FIRST, | 574 SetContentCustomCommandIdRange(IDC_CONTENT_CONTEXT_CUSTOM_FIRST, |
| 574 IDC_CONTENT_CONTEXT_CUSTOM_LAST); | 575 IDC_CONTENT_CONTEXT_CUSTOM_LAST); |
| 575 } | 576 } |
| 576 set_content_type(ContextMenuContentTypeFactory::Create( | 577 set_content_type(ContextMenuContentTypeFactory::Create( |
| 577 source_web_contents_, params)); | 578 source_web_contents_, params)); |
| 578 | 579 |
| 579 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 580 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 580 switches::kEnableSaveAsMenuLabelExperiment) || | 581 switches::kEnableSaveAsMenuLabelExperiment) || |
| (...skipping 1362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1943 void RenderViewContextMenu::NotifyMenuShown() { | 1944 void RenderViewContextMenu::NotifyMenuShown() { |
| 1944 content::NotificationService::current()->Notify( | 1945 content::NotificationService::current()->Notify( |
| 1945 chrome::NOTIFICATION_RENDER_VIEW_CONTEXT_MENU_SHOWN, | 1946 chrome::NOTIFICATION_RENDER_VIEW_CONTEXT_MENU_SHOWN, |
| 1946 content::Source<RenderViewContextMenu>(this), | 1947 content::Source<RenderViewContextMenu>(this), |
| 1947 content::NotificationService::NoDetails()); | 1948 content::NotificationService::NoDetails()); |
| 1948 } | 1949 } |
| 1949 | 1950 |
| 1950 void RenderViewContextMenu::NotifyURLOpened( | 1951 void RenderViewContextMenu::NotifyURLOpened( |
| 1951 const GURL& url, | 1952 const GURL& url, |
| 1952 content::WebContents* new_contents) { | 1953 content::WebContents* new_contents) { |
| 1954 LOG(ERROR) << "RVCM::NotifyURLOpened: " |
| 1955 << " url:" << url << " new_contents:" << new_contents; |
| 1956 |
| 1953 RetargetingDetails details; | 1957 RetargetingDetails details; |
| 1954 details.source_web_contents = source_web_contents_; | 1958 details.source_web_contents = source_web_contents_; |
| 1955 // Don't use GetRenderFrameHost() as it may be NULL. crbug.com/399789 | 1959 // Don't use GetRenderFrameHost() as it may be NULL. crbug.com/399789 |
| 1956 details.source_render_process_id = render_process_id_; | 1960 details.source_render_process_id = render_process_id_; |
| 1957 details.source_render_frame_id = render_frame_id_; | 1961 details.source_render_frame_id = render_frame_id_; |
| 1958 details.target_url = url; | 1962 details.target_url = url; |
| 1959 details.target_web_contents = new_contents; | 1963 details.target_web_contents = new_contents; |
| 1960 details.not_yet_in_tabstrip = false; | 1964 details.not_yet_in_tabstrip = false; |
| 1961 | 1965 |
| 1962 content::NotificationService::current()->Notify( | 1966 content::NotificationService::current()->Notify( |
| (...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2496 void RenderViewContextMenu::PluginActionAt( | 2500 void RenderViewContextMenu::PluginActionAt( |
| 2497 const gfx::Point& location, | 2501 const gfx::Point& location, |
| 2498 const WebPluginAction& action) { | 2502 const WebPluginAction& action) { |
| 2499 source_web_contents_->GetRenderViewHost()-> | 2503 source_web_contents_->GetRenderViewHost()-> |
| 2500 ExecutePluginActionAtLocation(location, action); | 2504 ExecutePluginActionAtLocation(location, action); |
| 2501 } | 2505 } |
| 2502 | 2506 |
| 2503 Browser* RenderViewContextMenu::GetBrowser() const { | 2507 Browser* RenderViewContextMenu::GetBrowser() const { |
| 2504 return chrome::FindBrowserWithWebContents(embedder_web_contents_); | 2508 return chrome::FindBrowserWithWebContents(embedder_web_contents_); |
| 2505 } | 2509 } |
| OLD | NEW |