| 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 #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 "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 | 177 |
| 178 void ExtensionHost::CreateViewWithoutBrowser() { | 178 void ExtensionHost::CreateViewWithoutBrowser() { |
| 179 CreateView(NULL); | 179 CreateView(NULL); |
| 180 } | 180 } |
| 181 | 181 |
| 182 WebContents* ExtensionHost::GetAssociatedWebContents() const { | 182 WebContents* ExtensionHost::GetAssociatedWebContents() const { |
| 183 return associated_web_contents_; | 183 return associated_web_contents_; |
| 184 } | 184 } |
| 185 | 185 |
| 186 content::RenderProcessHost* ExtensionHost::render_process_host() const { | 186 content::RenderProcessHost* ExtensionHost::render_process_host() const { |
| 187 return render_view_host()->process(); | 187 return render_view_host()->GetProcess(); |
| 188 } | 188 } |
| 189 | 189 |
| 190 RenderViewHost* ExtensionHost::render_view_host() const { | 190 RenderViewHost* ExtensionHost::render_view_host() const { |
| 191 // TODO(mpcomplete): This can be NULL. How do we handle that? | 191 // TODO(mpcomplete): This can be NULL. How do we handle that? |
| 192 return render_view_host_; | 192 return render_view_host_; |
| 193 } | 193 } |
| 194 | 194 |
| 195 bool ExtensionHost::IsRenderViewLive() const { | 195 bool ExtensionHost::IsRenderViewLive() const { |
| 196 return render_view_host()->IsRenderViewLive(); | 196 return render_view_host()->IsRenderViewLive(); |
| 197 } | 197 } |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_INFOBAR) { | 488 extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_INFOBAR) { |
| 489 render_view_host->EnablePreferredSizeMode(); | 489 render_view_host->EnablePreferredSizeMode(); |
| 490 } | 490 } |
| 491 | 491 |
| 492 // If the host is bound to a browser, then extract its window id. | 492 // If the host is bound to a browser, then extract its window id. |
| 493 // Extensions hosted in ExternalTabContainer objects may not have | 493 // Extensions hosted in ExternalTabContainer objects may not have |
| 494 // an associated browser. | 494 // an associated browser. |
| 495 const Browser* browser = GetBrowser(); | 495 const Browser* browser = GetBrowser(); |
| 496 if (browser) { | 496 if (browser) { |
| 497 render_view_host->Send(new ExtensionMsg_UpdateBrowserWindowId( | 497 render_view_host->Send(new ExtensionMsg_UpdateBrowserWindowId( |
| 498 render_view_host->routing_id(), | 498 render_view_host->GetRoutingID(), |
| 499 ExtensionTabUtil::GetWindowId(browser))); | 499 ExtensionTabUtil::GetWindowId(browser))); |
| 500 } | 500 } |
| 501 } | 501 } |
| 502 | 502 |
| 503 void ExtensionHost::RenderViewDeleted(RenderViewHost* render_view_host) { | 503 void ExtensionHost::RenderViewDeleted(RenderViewHost* render_view_host) { |
| 504 // If our RenderViewHost is deleted, fall back to the host_contents' current | 504 // If our RenderViewHost is deleted, fall back to the host_contents' current |
| 505 // RVH. There is sometimes a small gap between the pending RVH being deleted | 505 // RVH. There is sometimes a small gap between the pending RVH being deleted |
| 506 // and RenderViewCreated being called, so we update it here. | 506 // and RenderViewCreated being called, so we update it here. |
| 507 if (render_view_host == render_view_host_) | 507 if (render_view_host == render_view_host_) |
| 508 render_view_host_ = host_contents_->GetRenderViewHost(); | 508 render_view_host_ = host_contents_->GetRenderViewHost(); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 569 params.user_gesture = user_gesture; | 569 params.user_gesture = user_gesture; |
| 570 browser::Navigate(¶ms); | 570 browser::Navigate(¶ms); |
| 571 } | 571 } |
| 572 | 572 |
| 573 void ExtensionHost::RenderViewReady() { | 573 void ExtensionHost::RenderViewReady() { |
| 574 content::NotificationService::current()->Notify( | 574 content::NotificationService::current()->Notify( |
| 575 chrome::NOTIFICATION_EXTENSION_HOST_CREATED, | 575 chrome::NOTIFICATION_EXTENSION_HOST_CREATED, |
| 576 content::Source<Profile>(profile_), | 576 content::Source<Profile>(profile_), |
| 577 content::Details<ExtensionHost>(this)); | 577 content::Details<ExtensionHost>(this)); |
| 578 } | 578 } |
| OLD | NEW |