Chromium Code Reviews| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 42 #include "chrome/browser/profiles/profile_avatar_icon_util.h" | 42 #include "chrome/browser/profiles/profile_avatar_icon_util.h" |
| 43 #include "chrome/browser/profiles/profile_io_data.h" | 43 #include "chrome/browser/profiles/profile_io_data.h" |
| 44 #include "chrome/browser/profiles/profile_manager.h" | 44 #include "chrome/browser/profiles/profile_manager.h" |
| 45 #include "chrome/browser/profiles/profile_window.h" | 45 #include "chrome/browser/profiles/profile_window.h" |
| 46 #include "chrome/browser/renderer_context_menu/context_menu_content_type_factory .h" | 46 #include "chrome/browser/renderer_context_menu/context_menu_content_type_factory .h" |
| 47 #include "chrome/browser/renderer_context_menu/open_with_menu_factory.h" | 47 #include "chrome/browser/renderer_context_menu/open_with_menu_factory.h" |
| 48 #include "chrome/browser/renderer_context_menu/spelling_menu_observer.h" | 48 #include "chrome/browser/renderer_context_menu/spelling_menu_observer.h" |
| 49 #include "chrome/browser/search/search.h" | 49 #include "chrome/browser/search/search.h" |
| 50 #include "chrome/browser/search_engines/template_url_service_factory.h" | 50 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 51 #include "chrome/browser/spellchecker/spellcheck_service.h" | 51 #include "chrome/browser/spellchecker/spellcheck_service.h" |
| 52 #include "chrome/browser/tab_contents/retargeting_details.h" | |
| 53 #include "chrome/browser/translate/chrome_translate_client.h" | 52 #include "chrome/browser/translate/chrome_translate_client.h" |
| 54 #include "chrome/browser/translate/translate_service.h" | 53 #include "chrome/browser/translate/translate_service.h" |
| 55 #include "chrome/browser/ui/browser_commands.h" | 54 #include "chrome/browser/ui/browser_commands.h" |
| 56 #include "chrome/browser/ui/browser_finder.h" | 55 #include "chrome/browser/ui/browser_finder.h" |
| 57 #include "chrome/browser/ui/browser_navigator_params.h" | 56 #include "chrome/browser/ui/browser_navigator_params.h" |
| 58 #include "chrome/browser/ui/chrome_pages.h" | 57 #include "chrome/browser/ui/chrome_pages.h" |
| 59 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" | 58 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" |
| 60 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 59 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 61 #include "chrome/common/chrome_constants.h" | 60 #include "chrome/common/chrome_constants.h" |
| 62 #include "chrome/common/chrome_switches.h" | 61 #include "chrome/common/chrome_switches.h" |
| (...skipping 1896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1959 return handlers; | 1958 return handlers; |
| 1960 } | 1959 } |
| 1961 | 1960 |
| 1962 void RenderViewContextMenu::NotifyMenuShown() { | 1961 void RenderViewContextMenu::NotifyMenuShown() { |
| 1963 content::NotificationService::current()->Notify( | 1962 content::NotificationService::current()->Notify( |
| 1964 chrome::NOTIFICATION_RENDER_VIEW_CONTEXT_MENU_SHOWN, | 1963 chrome::NOTIFICATION_RENDER_VIEW_CONTEXT_MENU_SHOWN, |
| 1965 content::Source<RenderViewContextMenu>(this), | 1964 content::Source<RenderViewContextMenu>(this), |
| 1966 content::NotificationService::NoDetails()); | 1965 content::NotificationService::NoDetails()); |
| 1967 } | 1966 } |
| 1968 | 1967 |
| 1969 void RenderViewContextMenu::NotifyURLOpened( | |
| 1970 const GURL& url, | |
| 1971 content::WebContents* new_contents) { | |
| 1972 RetargetingDetails details; | |
| 1973 details.source_web_contents = source_web_contents_; | |
| 1974 // Don't use GetRenderFrameHost() as it may be NULL. crbug.com/399789 | |
| 1975 details.source_render_process_id = render_process_id_; | |
| 1976 details.source_render_frame_id = render_frame_id_; | |
| 1977 details.target_url = url; | |
| 1978 details.target_web_contents = new_contents; | |
| 1979 details.not_yet_in_tabstrip = false; | |
| 1980 | |
| 1981 content::NotificationService::current()->Notify( | |
| 1982 chrome::NOTIFICATION_RETARGETING, | |
|
Avi (use Gerrit)
2017/02/17 22:52:07
Whoo!
| |
| 1983 content::Source<Profile>(GetProfile()), | |
| 1984 content::Details<RetargetingDetails>(&details)); | |
| 1985 } | |
| 1986 | |
| 1987 base::string16 RenderViewContextMenu::PrintableSelectionText() { | 1968 base::string16 RenderViewContextMenu::PrintableSelectionText() { |
| 1988 return gfx::TruncateString(params_.selection_text, | 1969 return gfx::TruncateString(params_.selection_text, |
| 1989 kMaxSelectionTextLength, | 1970 kMaxSelectionTextLength, |
| 1990 gfx::WORD_BREAK); | 1971 gfx::WORD_BREAK); |
| 1991 } | 1972 } |
| 1992 | 1973 |
| 1993 void RenderViewContextMenu::EscapeAmpersands(base::string16* text) { | 1974 void RenderViewContextMenu::EscapeAmpersands(base::string16* text) { |
| 1994 base::ReplaceChars(*text, base::ASCIIToUTF16("&"), base::ASCIIToUTF16("&&"), | 1975 base::ReplaceChars(*text, base::ASCIIToUTF16("&"), base::ASCIIToUTF16("&&"), |
| 1995 text); | 1976 text); |
| 1996 } | 1977 } |
| (...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2524 void RenderViewContextMenu::PluginActionAt( | 2505 void RenderViewContextMenu::PluginActionAt( |
| 2525 const gfx::Point& location, | 2506 const gfx::Point& location, |
| 2526 const WebPluginAction& action) { | 2507 const WebPluginAction& action) { |
| 2527 source_web_contents_->GetRenderViewHost()-> | 2508 source_web_contents_->GetRenderViewHost()-> |
| 2528 ExecutePluginActionAtLocation(location, action); | 2509 ExecutePluginActionAtLocation(location, action); |
| 2529 } | 2510 } |
| 2530 | 2511 |
| 2531 Browser* RenderViewContextMenu::GetBrowser() const { | 2512 Browser* RenderViewContextMenu::GetBrowser() const { |
| 2532 return chrome::FindBrowserWithWebContents(embedder_web_contents_); | 2513 return chrome::FindBrowserWithWebContents(embedder_web_contents_); |
| 2533 } | 2514 } |
| OLD | NEW |