| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <set> | 6 #include <set> |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "chrome/browser/tab_contents/render_view_context_menu.h" | 9 #include "chrome/browser/tab_contents/render_view_context_menu.h" |
| 10 | 10 |
| (...skipping 1813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1824 if (!model) | 1824 if (!model) |
| 1825 return; | 1825 return; |
| 1826 model->Load(); | 1826 model->Load(); |
| 1827 | 1827 |
| 1828 TabContentsWrapper* tab_contents_wrapper = | 1828 TabContentsWrapper* tab_contents_wrapper = |
| 1829 TabContentsWrapper::GetCurrentWrapperForContents( | 1829 TabContentsWrapper::GetCurrentWrapperForContents( |
| 1830 source_web_contents_); | 1830 source_web_contents_); |
| 1831 if (tab_contents_wrapper && | 1831 if (tab_contents_wrapper && |
| 1832 tab_contents_wrapper->search_engine_tab_helper() && | 1832 tab_contents_wrapper->search_engine_tab_helper() && |
| 1833 tab_contents_wrapper->search_engine_tab_helper()->delegate()) { | 1833 tab_contents_wrapper->search_engine_tab_helper()->delegate()) { |
| 1834 string16 keyword(TemplateURLService::GenerateKeyword(params_.page_url, | 1834 string16 keyword(TemplateURLService::GenerateKeyword(params_.page_url)); |
| 1835 false)); | |
| 1836 TemplateURLData data; | 1835 TemplateURLData data; |
| 1837 data.short_name = keyword; | 1836 data.short_name = keyword; |
| 1838 data.SetKeyword(keyword); | 1837 data.SetKeyword(keyword); |
| 1839 data.SetURL(params_.keyword_url.spec()); | 1838 data.SetURL(params_.keyword_url.spec()); |
| 1840 data.favicon_url = | 1839 data.favicon_url = |
| 1841 TemplateURL::GenerateFaviconURL(params_.page_url.GetOrigin()); | 1840 TemplateURL::GenerateFaviconURL(params_.page_url.GetOrigin()); |
| 1842 // Takes ownership of the TemplateURL. | 1841 // Takes ownership of the TemplateURL. |
| 1843 tab_contents_wrapper->search_engine_tab_helper()->delegate()-> | 1842 tab_contents_wrapper->search_engine_tab_helper()->delegate()-> |
| 1844 ConfirmAddSearchProvider(new TemplateURL(profile_, data), profile_); | 1843 ConfirmAddSearchProvider(new TemplateURL(profile_, data), profile_); |
| 1845 } | 1844 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1864 break; | 1863 break; |
| 1865 } | 1864 } |
| 1866 | 1865 |
| 1867 default: | 1866 default: |
| 1868 NOTREACHED(); | 1867 NOTREACHED(); |
| 1869 break; | 1868 break; |
| 1870 } | 1869 } |
| 1871 } | 1870 } |
| 1872 | 1871 |
| 1873 ProtocolHandlerRegistry::ProtocolHandlerList | 1872 ProtocolHandlerRegistry::ProtocolHandlerList |
| 1874 RenderViewContextMenu::GetHandlersForLinkUrl() { | 1873 RenderViewContextMenu::GetHandlersForLinkUrl() { |
| 1875 ProtocolHandlerRegistry::ProtocolHandlerList handlers = | 1874 ProtocolHandlerRegistry::ProtocolHandlerList handlers = |
| 1876 protocol_handler_registry_->GetHandlersFor(params_.link_url.scheme()); | 1875 protocol_handler_registry_->GetHandlersFor(params_.link_url.scheme()); |
| 1877 std::sort(handlers.begin(), handlers.end()); | 1876 std::sort(handlers.begin(), handlers.end()); |
| 1878 return handlers; | 1877 return handlers; |
| 1879 } | 1878 } |
| 1880 | 1879 |
| 1881 void RenderViewContextMenu::MenuWillShow(ui::SimpleMenuModel* source) { | 1880 void RenderViewContextMenu::MenuWillShow(ui::SimpleMenuModel* source) { |
| 1882 // Ignore notifications from submenus. | 1881 // Ignore notifications from submenus. |
| 1883 if (source != &menu_model_) | 1882 if (source != &menu_model_) |
| 1884 return; | 1883 return; |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1979 source_web_contents_->GetRenderViewHost()-> | 1978 source_web_contents_->GetRenderViewHost()-> |
| 1980 ExecuteMediaPlayerActionAtLocation(location, action); | 1979 ExecuteMediaPlayerActionAtLocation(location, action); |
| 1981 } | 1980 } |
| 1982 | 1981 |
| 1983 void RenderViewContextMenu::PluginActionAt( | 1982 void RenderViewContextMenu::PluginActionAt( |
| 1984 const gfx::Point& location, | 1983 const gfx::Point& location, |
| 1985 const WebPluginAction& action) { | 1984 const WebPluginAction& action) { |
| 1986 source_web_contents_->GetRenderViewHost()-> | 1985 source_web_contents_->GetRenderViewHost()-> |
| 1987 ExecutePluginActionAtLocation(location, action); | 1986 ExecutePluginActionAtLocation(location, action); |
| 1988 } | 1987 } |
| OLD | NEW |