OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/extensions/extension_host.h" | 5 #include "chrome/browser/extensions/extension_host.h" |
6 | 6 |
7 #include <list> | 7 #include <list> |
8 | 8 |
9 #include "app/keyboard_codes.h" | 9 #include "app/keyboard_codes.h" |
10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 ProcessCreationQueue::get()->CreateSoon(this); | 205 ProcessCreationQueue::get()->CreateSoon(this); |
206 } | 206 } |
207 } | 207 } |
208 | 208 |
209 void ExtensionHost::CreateRenderViewNow() { | 209 void ExtensionHost::CreateRenderViewNow() { |
210 render_view_host_->CreateRenderView(string16()); | 210 render_view_host_->CreateRenderView(string16()); |
211 NavigateToURL(url_); | 211 NavigateToURL(url_); |
212 DCHECK(IsRenderViewLive()); | 212 DCHECK(IsRenderViewLive()); |
213 } | 213 } |
214 | 214 |
| 215 Browser* ExtensionHost::GetBrowser() const { |
| 216 return view() ? view()->browser() : NULL; |
| 217 } |
| 218 |
| 219 gfx::NativeView ExtensionHost::GetNativeViewOfHost() { |
| 220 return view() ? view()->native_view() : NULL; |
| 221 } |
| 222 |
215 void ExtensionHost::NavigateToURL(const GURL& url) { | 223 void ExtensionHost::NavigateToURL(const GURL& url) { |
216 // Prevent explicit navigation to another extension id's pages. | 224 // Prevent explicit navigation to another extension id's pages. |
217 // This method is only called by some APIs, so we still need to protect | 225 // This method is only called by some APIs, so we still need to protect |
218 // DidNavigate below (location = ""). | 226 // DidNavigate below (location = ""). |
219 if (url.SchemeIs(chrome::kExtensionScheme) && | 227 if (url.SchemeIs(chrome::kExtensionScheme) && |
220 url.host() != extension_->id()) { | 228 url.host() != extension_->id()) { |
221 // TODO(erikkay) communicate this back to the caller? | 229 // TODO(erikkay) communicate this back to the caller? |
222 return; | 230 return; |
223 } | 231 } |
224 | 232 |
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 // Extensions hosted in ExternalTabContainer objects may not have | 714 // Extensions hosted in ExternalTabContainer objects may not have |
707 // an associated browser. | 715 // an associated browser. |
708 Browser* browser = GetBrowser(); | 716 Browser* browser = GetBrowser(); |
709 if (browser) | 717 if (browser) |
710 window_id = ExtensionTabUtil::GetWindowId(browser); | 718 window_id = ExtensionTabUtil::GetWindowId(browser); |
711 } else if (extension_host_type_ != ViewType::EXTENSION_BACKGROUND_PAGE) { | 719 } else if (extension_host_type_ != ViewType::EXTENSION_BACKGROUND_PAGE) { |
712 NOTREACHED(); | 720 NOTREACHED(); |
713 } | 721 } |
714 return window_id; | 722 return window_id; |
715 } | 723 } |
OLD | NEW |