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 #import "chrome/browser/renderer_host/chrome_render_widget_host_view_mac_delegat
e.h" | 5 #import "chrome/browser/renderer_host/chrome_render_widget_host_view_mac_delegat
e.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
10 #include "chrome/browser/devtools/devtools_window.h" | 10 #include "chrome/browser/devtools/devtools_window.h" |
11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
12 #import "chrome/browser/renderer_host/chrome_render_widget_host_view_mac_history
_swiper.h" | 12 #import "chrome/browser/renderer_host/chrome_render_widget_host_view_mac_history
_swiper.h" |
13 #include "chrome/browser/spellchecker/spellcheck_platform.h" | |
14 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
15 #include "chrome/browser/ui/browser_commands.h" | 14 #include "chrome/browser/ui/browser_commands.h" |
16 #include "chrome/browser/ui/browser_finder.h" | 15 #include "chrome/browser/ui/browser_finder.h" |
17 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 16 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
18 #include "chrome/common/pref_names.h" | |
19 #include "chrome/common/url_constants.h" | 17 #include "chrome/common/url_constants.h" |
20 #include "components/prefs/pref_service.h" | 18 #include "components/prefs/pref_service.h" |
| 19 #include "components/spellcheck/browser/pref_names.h" |
| 20 #include "components/spellcheck/browser/spellcheck_platform.h" |
21 #include "components/spellcheck/common/spellcheck_messages.h" | 21 #include "components/spellcheck/common/spellcheck_messages.h" |
22 #include "content/public/browser/render_process_host.h" | 22 #include "content/public/browser/render_process_host.h" |
23 #include "content/public/browser/render_view_host.h" | 23 #include "content/public/browser/render_view_host.h" |
24 #include "content/public/browser/render_widget_host.h" | 24 #include "content/public/browser/render_widget_host.h" |
25 #include "content/public/browser/render_widget_host_view.h" | 25 #include "content/public/browser/render_widget_host_view.h" |
26 #include "content/public/browser/web_contents.h" | 26 #include "content/public/browser/web_contents.h" |
27 | 27 |
28 using content::RenderViewHost; | 28 using content::RenderViewHost; |
29 | 29 |
30 @interface ChromeRenderWidgetHostViewMacDelegate () <HistorySwiperDelegate> | 30 @interface ChromeRenderWidgetHostViewMacDelegate () <HistorySwiperDelegate> |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 } | 116 } |
117 | 117 |
118 // TODO(groby): Clarify who sends this and if toggleContinuousSpellChecking: | 118 // TODO(groby): Clarify who sends this and if toggleContinuousSpellChecking: |
119 // is still necessary. | 119 // is still necessary. |
120 if (action == @selector(toggleContinuousSpellChecking:)) { | 120 if (action == @selector(toggleContinuousSpellChecking:)) { |
121 if ([(id)item respondsToSelector:@selector(setState:)]) { | 121 if ([(id)item respondsToSelector:@selector(setState:)]) { |
122 content::RenderProcessHost* host = renderWidgetHost_->GetProcess(); | 122 content::RenderProcessHost* host = renderWidgetHost_->GetProcess(); |
123 Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); | 123 Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); |
124 DCHECK(profile); | 124 DCHECK(profile); |
125 NSCellStateValue checkedState = | 125 NSCellStateValue checkedState = |
126 profile->GetPrefs()->GetBoolean(prefs::kEnableContinuousSpellcheck) ? | 126 profile->GetPrefs()->GetBoolean( |
127 NSOnState : NSOffState; | 127 spellcheck::prefs::kEnableContinuousSpellcheck) |
| 128 ? NSOnState |
| 129 : NSOffState; |
128 [(id)item setState:checkedState]; | 130 [(id)item setState:checkedState]; |
129 } | 131 } |
130 *valid = YES; | 132 *valid = YES; |
131 return YES; | 133 return YES; |
132 } | 134 } |
133 | 135 |
134 return NO; | 136 return NO; |
135 } | 137 } |
136 | 138 |
137 - (void)rendererHandledWheelEvent:(const blink::WebMouseWheelEvent&)event | 139 - (void)rendererHandledWheelEvent:(const blink::WebMouseWheelEvent&)event |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 renderWidgetHost_->Send(new SpellCheckMsg_ToggleSpellPanel( | 191 renderWidgetHost_->Send(new SpellCheckMsg_ToggleSpellPanel( |
190 renderWidgetHost_->GetRoutingID(), | 192 renderWidgetHost_->GetRoutingID(), |
191 spellcheck_platform::SpellingPanelVisible())); | 193 spellcheck_platform::SpellingPanelVisible())); |
192 } | 194 } |
193 | 195 |
194 - (void)toggleContinuousSpellChecking:(id)sender { | 196 - (void)toggleContinuousSpellChecking:(id)sender { |
195 content::RenderProcessHost* host = renderWidgetHost_->GetProcess(); | 197 content::RenderProcessHost* host = renderWidgetHost_->GetProcess(); |
196 Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); | 198 Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); |
197 DCHECK(profile); | 199 DCHECK(profile); |
198 PrefService* pref = profile->GetPrefs(); | 200 PrefService* pref = profile->GetPrefs(); |
199 pref->SetBoolean(prefs::kEnableContinuousSpellcheck, | 201 pref->SetBoolean( |
200 !pref->GetBoolean(prefs::kEnableContinuousSpellcheck)); | 202 spellcheck::prefs::kEnableContinuousSpellcheck, |
| 203 !pref->GetBoolean(spellcheck::prefs::kEnableContinuousSpellcheck)); |
201 } | 204 } |
202 | 205 |
203 // END Spellchecking methods | 206 // END Spellchecking methods |
204 | 207 |
205 @end | 208 @end |
OLD | NEW |