| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/tab_contents/render_view_context_menu.h" | 5 #include "chrome/browser/tab_contents/render_view_context_menu.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 } | 365 } |
| 366 } | 366 } |
| 367 | 367 |
| 368 void DevToolsInspectElementAt(RenderViewHost* rvh, int x, int y) { | 368 void DevToolsInspectElementAt(RenderViewHost* rvh, int x, int y) { |
| 369 DevToolsWindow::InspectElement(rvh, x, y); | 369 DevToolsWindow::InspectElement(rvh, x, y); |
| 370 } | 370 } |
| 371 | 371 |
| 372 // Helper function to escape "&" as "&&". | 372 // Helper function to escape "&" as "&&". |
| 373 void EscapeAmpersands(string16* text) { | 373 void EscapeAmpersands(string16* text) { |
| 374 const char16 ampersand[] = {'&', 0}; | 374 const char16 ampersand[] = {'&', 0}; |
| 375 ReplaceChars(*text, ampersand, ASCIIToUTF16("&&"), text); | 375 base::ReplaceChars(*text, ampersand, ASCIIToUTF16("&&"), text); |
| 376 } | 376 } |
| 377 | 377 |
| 378 } // namespace | 378 } // namespace |
| 379 | 379 |
| 380 // static | 380 // static |
| 381 const size_t RenderViewContextMenu::kMaxSelectionTextLength = 50; | 381 const size_t RenderViewContextMenu::kMaxSelectionTextLength = 50; |
| 382 | 382 |
| 383 // static | 383 // static |
| 384 bool RenderViewContextMenu::IsDevToolsURL(const GURL& url) { | 384 bool RenderViewContextMenu::IsDevToolsURL(const GURL& url) { |
| 385 return url.SchemeIs(chrome::kChromeDevToolsScheme); | 385 return url.SchemeIs(chrome::kChromeDevToolsScheme); |
| (...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1008 } | 1008 } |
| 1009 } | 1009 } |
| 1010 | 1010 |
| 1011 void RenderViewContextMenu::AppendSearchProvider() { | 1011 void RenderViewContextMenu::AppendSearchProvider() { |
| 1012 DCHECK(profile_); | 1012 DCHECK(profile_); |
| 1013 | 1013 |
| 1014 TrimWhitespace(params_.selection_text, TRIM_ALL, ¶ms_.selection_text); | 1014 TrimWhitespace(params_.selection_text, TRIM_ALL, ¶ms_.selection_text); |
| 1015 if (params_.selection_text.empty()) | 1015 if (params_.selection_text.empty()) |
| 1016 return; | 1016 return; |
| 1017 | 1017 |
| 1018 ReplaceChars(params_.selection_text, AutocompleteMatch::kInvalidChars, | 1018 base::ReplaceChars(params_.selection_text, AutocompleteMatch::kInvalidChars, |
| 1019 ASCIIToUTF16(" "), ¶ms_.selection_text); | 1019 ASCIIToUTF16(" "), ¶ms_.selection_text); |
| 1020 | 1020 |
| 1021 AutocompleteMatch match; | 1021 AutocompleteMatch match; |
| 1022 AutocompleteClassifierFactory::GetForProfile(profile_)->Classify( | 1022 AutocompleteClassifierFactory::GetForProfile(profile_)->Classify( |
| 1023 params_.selection_text, false, false, &match, NULL); | 1023 params_.selection_text, false, false, &match, NULL); |
| 1024 selection_navigation_url_ = match.destination_url; | 1024 selection_navigation_url_ = match.destination_url; |
| 1025 if (!selection_navigation_url_.is_valid()) | 1025 if (!selection_navigation_url_.is_valid()) |
| 1026 return; | 1026 return; |
| 1027 | 1027 |
| 1028 string16 printable_selection_text = PrintableSelectionText(); | 1028 string16 printable_selection_text = PrintableSelectionText(); |
| 1029 EscapeAmpersands(&printable_selection_text); | 1029 EscapeAmpersands(&printable_selection_text); |
| (...skipping 1082 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2112 source_web_contents_->GetRenderViewHost()-> | 2112 source_web_contents_->GetRenderViewHost()-> |
| 2113 ExecuteMediaPlayerActionAtLocation(location, action); | 2113 ExecuteMediaPlayerActionAtLocation(location, action); |
| 2114 } | 2114 } |
| 2115 | 2115 |
| 2116 void RenderViewContextMenu::PluginActionAt( | 2116 void RenderViewContextMenu::PluginActionAt( |
| 2117 const gfx::Point& location, | 2117 const gfx::Point& location, |
| 2118 const WebPluginAction& action) { | 2118 const WebPluginAction& action) { |
| 2119 source_web_contents_->GetRenderViewHost()-> | 2119 source_web_contents_->GetRenderViewHost()-> |
| 2120 ExecutePluginActionAtLocation(location, action); | 2120 ExecutePluginActionAtLocation(location, action); |
| 2121 } | 2121 } |
| OLD | NEW |