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/ui/cocoa/renderer_context_menu/render_view_context_menu
_mac.h" | 5 #include "chrome/browser/ui/cocoa/renderer_context_menu/render_view_context_menu
_mac.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #import "base/mac/scoped_sending_event.h" | 8 #import "base/mac/scoped_sending_event.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 | 46 |
47 } // namespace | 47 } // namespace |
48 | 48 |
49 // OSX implemenation of the ToolkitDelegate. | 49 // OSX implemenation of the ToolkitDelegate. |
50 // This simply (re)delegates calls to RVContextMenuMac because they do not | 50 // This simply (re)delegates calls to RVContextMenuMac because they do not |
51 // have to be componentized. | 51 // have to be componentized. |
52 class ToolkitDelegateMac : public RenderViewContextMenuBase::ToolkitDelegate { | 52 class ToolkitDelegateMac : public RenderViewContextMenuBase::ToolkitDelegate { |
53 public: | 53 public: |
54 explicit ToolkitDelegateMac(RenderViewContextMenuMac* context_menu) | 54 explicit ToolkitDelegateMac(RenderViewContextMenuMac* context_menu) |
55 : context_menu_(context_menu) {} | 55 : context_menu_(context_menu) {} |
56 virtual ~ToolkitDelegateMac() {} | 56 ~ToolkitDelegateMac() override {} |
57 | 57 |
58 private: | 58 private: |
59 // ToolkitDelegate: | 59 // ToolkitDelegate: |
60 virtual void Init(ui::SimpleMenuModel* menu_model) override { | 60 void Init(ui::SimpleMenuModel* menu_model) override { |
61 context_menu_->InitToolkitMenu(); | 61 context_menu_->InitToolkitMenu(); |
62 } | 62 } |
63 virtual void Cancel() override{ | 63 void Cancel() override { context_menu_->CancelToolkitMenu(); } |
64 context_menu_->CancelToolkitMenu(); | 64 void UpdateMenuItem(int command_id, |
65 } | 65 bool enabled, |
66 virtual void UpdateMenuItem(int command_id, | 66 bool hidden, |
67 bool enabled, | 67 const base::string16& title) override { |
68 bool hidden, | |
69 const base::string16& title) override { | |
70 context_menu_->UpdateToolkitMenuItem( | 68 context_menu_->UpdateToolkitMenuItem( |
71 command_id, enabled, hidden, title); | 69 command_id, enabled, hidden, title); |
72 } | 70 } |
73 | 71 |
74 RenderViewContextMenuMac* context_menu_; | 72 RenderViewContextMenuMac* context_menu_; |
75 DISALLOW_COPY_AND_ASSIGN(ToolkitDelegateMac); | 73 DISALLOW_COPY_AND_ASSIGN(ToolkitDelegateMac); |
76 }; | 74 }; |
77 | 75 |
78 // Obj-C bridge class that is the target of all items in the context menu. | 76 // Obj-C bridge class that is the target of all items in the context menu. |
79 // Relies on the tag being set to the command id. | 77 // Relies on the tag being set to the command id. |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 content::RenderWidgetHostView* view = GetRenderViewHost()->GetView(); | 301 content::RenderWidgetHostView* view = GetRenderViewHost()->GetView(); |
304 if (view) | 302 if (view) |
305 view->SpeakSelection(); | 303 view->SpeakSelection(); |
306 } | 304 } |
307 | 305 |
308 void RenderViewContextMenuMac::StopSpeaking() { | 306 void RenderViewContextMenuMac::StopSpeaking() { |
309 content::RenderWidgetHostView* view = GetRenderViewHost()->GetView(); | 307 content::RenderWidgetHostView* view = GetRenderViewHost()->GetView(); |
310 if (view) | 308 if (view) |
311 view->StopSpeaking(); | 309 view->StopSpeaking(); |
312 } | 310 } |
OLD | NEW |