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 <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
452 source_web_contents_, params)); | 452 source_web_contents_, params)); |
453 } | 453 } |
454 | 454 |
455 RenderViewContextMenu::~RenderViewContextMenu() { | 455 RenderViewContextMenu::~RenderViewContextMenu() { |
456 } | 456 } |
457 | 457 |
458 // Menu construction functions ------------------------------------------------- | 458 // Menu construction functions ------------------------------------------------- |
459 | 459 |
460 void RenderViewContextMenu::Init() { | 460 void RenderViewContextMenu::Init() { |
461 InitMenu(); | 461 InitMenu(); |
462 PlatformInit(); | 462 if (toolkit_delegate_) |
463 toolkit_delegate_->Init(&menu_model_); | |
463 } | 464 } |
464 | 465 |
465 void RenderViewContextMenu::Cancel() { | 466 void RenderViewContextMenu::Cancel() { |
466 PlatformCancel(); | 467 if (toolkit_delegate_) |
468 toolkit_delegate_->Cancel(); | |
467 } | 469 } |
468 | 470 |
469 static bool ExtensionPatternMatch(const extensions::URLPatternSet& patterns, | 471 static bool ExtensionPatternMatch(const extensions::URLPatternSet& patterns, |
470 const GURL& url) { | 472 const GURL& url) { |
471 // No patterns means no restriction, so that implicitly matches. | 473 // No patterns means no restriction, so that implicitly matches. |
472 if (patterns.is_empty()) | 474 if (patterns.is_empty()) |
473 return true; | 475 return true; |
474 return patterns.MatchesURL(url); | 476 return patterns.MatchesURL(url); |
475 } | 477 } |
476 | 478 |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
762 void RenderViewContextMenu::AddSubMenu(int command_id, | 764 void RenderViewContextMenu::AddSubMenu(int command_id, |
763 const base::string16& label, | 765 const base::string16& label, |
764 ui::MenuModel* model) { | 766 ui::MenuModel* model) { |
765 menu_model_.AddSubMenu(command_id, label, model); | 767 menu_model_.AddSubMenu(command_id, label, model); |
766 } | 768 } |
767 | 769 |
768 void RenderViewContextMenu::UpdateMenuItem(int command_id, | 770 void RenderViewContextMenu::UpdateMenuItem(int command_id, |
769 bool enabled, | 771 bool enabled, |
770 bool hidden, | 772 bool hidden, |
771 const base::string16& label) { | 773 const base::string16& label) { |
772 // This function needs platform-specific implementation. | 774 if (toolkit_delegate_) { |
773 NOTIMPLEMENTED(); | 775 toolkit_delegate_->UpdateMenuItem(command_id, |
sky
2014/07/31 21:23:43
It seems like you're duplicating some of what Menu
oshima
2014/07/31 22:02:15
I think it's quite different (partly due to the wa
sky
2014/07/31 22:19:40
I don't think it would be that much. If you make M
| |
776 enabled, | |
777 hidden, | |
778 label); | |
779 } | |
774 } | 780 } |
775 | 781 |
776 RenderViewHost* RenderViewContextMenu::GetRenderViewHost() const { | 782 RenderViewHost* RenderViewContextMenu::GetRenderViewHost() const { |
777 return source_web_contents_->GetRenderViewHost(); | 783 return source_web_contents_->GetRenderViewHost(); |
778 } | 784 } |
779 | 785 |
780 WebContents* RenderViewContextMenu::GetWebContents() const { | 786 WebContents* RenderViewContextMenu::GetWebContents() const { |
781 return source_web_contents_; | 787 return source_web_contents_; |
782 } | 788 } |
783 | 789 |
(...skipping 1251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2035 source_web_contents_->GetRenderViewHost()-> | 2041 source_web_contents_->GetRenderViewHost()-> |
2036 ExecuteMediaPlayerActionAtLocation(location, action); | 2042 ExecuteMediaPlayerActionAtLocation(location, action); |
2037 } | 2043 } |
2038 | 2044 |
2039 void RenderViewContextMenu::PluginActionAt( | 2045 void RenderViewContextMenu::PluginActionAt( |
2040 const gfx::Point& location, | 2046 const gfx::Point& location, |
2041 const WebPluginAction& action) { | 2047 const WebPluginAction& action) { |
2042 source_web_contents_->GetRenderViewHost()-> | 2048 source_web_contents_->GetRenderViewHost()-> |
2043 ExecutePluginActionAtLocation(location, action); | 2049 ExecutePluginActionAtLocation(location, action); |
2044 } | 2050 } |
OLD | NEW |