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/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 }; | 69 }; |
70 | 70 |
71 } // namespace ChromeRenderWidgetHostViewMacDelegateInternal | 71 } // namespace ChromeRenderWidgetHostViewMacDelegateInternal |
72 | 72 |
73 @implementation ChromeRenderWidgetHostViewMacDelegate | 73 @implementation ChromeRenderWidgetHostViewMacDelegate |
74 | 74 |
75 - (id)initWithRenderWidgetHost:(content::RenderWidgetHost*)renderWidgetHost { | 75 - (id)initWithRenderWidgetHost:(content::RenderWidgetHost*)renderWidgetHost { |
76 self = [super init]; | 76 self = [super init]; |
77 if (self) { | 77 if (self) { |
78 renderWidgetHost_ = renderWidgetHost; | 78 renderWidgetHost_ = renderWidgetHost; |
79 NSView* nativeView = renderWidgetHost_->GetView()->GetNativeView(); | 79 // if |renderWidgetHost_| belongs to a BrowserPluginGuest, then it won't |
80 view_id_util::SetID(nativeView, VIEW_ID_TAB_CONTAINER); | 80 // have a view yet. |
| 81 if (renderWidgetHost_->GetView()) { |
| 82 NSView* nativeView = renderWidgetHost_->GetView()->GetNativeView(); |
| 83 view_id_util::SetID(nativeView, VIEW_ID_TAB_CONTAINER); |
| 84 } |
81 | 85 |
82 if (renderWidgetHost_->IsRenderView()) { | 86 if (renderWidgetHost_->IsRenderView()) { |
83 spellingObserver_.reset( | 87 spellingObserver_.reset( |
84 new ChromeRenderWidgetHostViewMacDelegateInternal::SpellCheckObserver( | 88 new ChromeRenderWidgetHostViewMacDelegateInternal::SpellCheckObserver( |
85 RenderViewHost::From(renderWidgetHost_), self)); | 89 RenderViewHost::From(renderWidgetHost_), self)); |
86 } | 90 } |
87 | 91 |
88 historySwiper_.reset([[HistorySwiper alloc] initWithDelegate:self]); | 92 historySwiper_.reset([[HistorySwiper alloc] initWithDelegate:self]); |
89 } | 93 } |
90 return self; | 94 return self; |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 } | 259 } |
256 | 260 |
257 - (void)spellCheckEnabled:(BOOL)enabled checked:(BOOL)checked { | 261 - (void)spellCheckEnabled:(BOOL)enabled checked:(BOOL)checked { |
258 spellcheckEnabled_ = enabled; | 262 spellcheckEnabled_ = enabled; |
259 spellcheckChecked_ = checked; | 263 spellcheckChecked_ = checked; |
260 } | 264 } |
261 | 265 |
262 // END Spellchecking methods | 266 // END Spellchecking methods |
263 | 267 |
264 @end | 268 @end |
OLD | NEW |