| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 + (void)storeFilteredEntriesForTestingInArray:(NSMutableArray*)array { | 100 + (void)storeFilteredEntriesForTestingInArray:(NSMutableArray*)array { |
| 101 [g_filtered_entries_array release]; | 101 [g_filtered_entries_array release]; |
| 102 g_filtered_entries_array = [array retain]; | 102 g_filtered_entries_array = [array retain]; |
| 103 } | 103 } |
| 104 | 104 |
| 105 + (void)load { | 105 + (void)load { |
| 106 // Swizzling should not happen in renderer processes or on 10.6. | 106 // Swizzling should not happen in renderer processes or on 10.6. |
| 107 if (![[NSProcessInfo processInfo] cr_isMainBrowserOrTestProcess]) | 107 if (![[NSProcessInfo processInfo] cr_isMainBrowserOrTestProcess]) |
| 108 return; | 108 return; |
| 109 | 109 |
| 110 // Services filtering does not work on OS X 10.6. | |
| 111 if (base::mac::IsOSSnowLeopard()) | |
| 112 return; | |
| 113 | |
| 114 static dispatch_once_t onceToken; | 110 static dispatch_once_t onceToken; |
| 115 dispatch_once(&onceToken, ^{ | 111 dispatch_once(&onceToken, ^{ |
| 116 // Confirm that the AppKit's private _NSServiceEntry class exists. This | 112 // Confirm that the AppKit's private _NSServiceEntry class exists. This |
| 117 // class cannot be accessed at link time and is not guaranteed to exist in | 113 // class cannot be accessed at link time and is not guaranteed to exist in |
| 118 // past or future AppKits so use NSClassFromString() to locate it. Also | 114 // past or future AppKits so use NSClassFromString() to locate it. Also |
| 119 // check that the class implements the bundleIdentifier method. The browser | 115 // check that the class implements the bundleIdentifier method. The browser |
| 120 // test checks for all of this as well, but the checks here ensure that we | 116 // test checks for all of this as well, but the checks here ensure that we |
| 121 // don't crash out in the wild when running on some future version of OS X. | 117 // don't crash out in the wild when running on some future version of OS X. |
| 122 // Odds are a developer will be running a newer version of OS X sooner than | 118 // Odds are a developer will be running a newer version of OS X sooner than |
| 123 // the bots - NOTREACHED() will get them to tell us if compatibility breaks. | 119 // the bots - NOTREACHED() will get them to tell us if compatibility breaks. |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 if (view) | 438 if (view) |
| 443 view->SpeakSelection(); | 439 view->SpeakSelection(); |
| 444 } | 440 } |
| 445 | 441 |
| 446 void RenderViewContextMenuMac::StopSpeaking() { | 442 void RenderViewContextMenuMac::StopSpeaking() { |
| 447 content::RenderWidgetHostView* view = | 443 content::RenderWidgetHostView* view = |
| 448 GetRenderViewHost()->GetWidget()->GetView(); | 444 GetRenderViewHost()->GetWidget()->GetView(); |
| 449 if (view) | 445 if (view) |
| 450 view->StopSpeaking(); | 446 view->StopSpeaking(); |
| 451 } | 447 } |
| OLD | NEW |