| 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 | 176 |
| 177 void ExtensionHost::CreateViewWithoutBrowser() { | 177 void ExtensionHost::CreateViewWithoutBrowser() { |
| 178 CreateView(NULL); | 178 CreateView(NULL); |
| 179 } | 179 } |
| 180 | 180 |
| 181 WebContents* ExtensionHost::GetAssociatedWebContents() const { | 181 WebContents* ExtensionHost::GetAssociatedWebContents() const { |
| 182 return associated_web_contents_; | 182 return associated_web_contents_; |
| 183 } | 183 } |
| 184 | 184 |
| 185 content::RenderProcessHost* ExtensionHost::render_process_host() const { | 185 content::RenderProcessHost* ExtensionHost::render_process_host() const { |
| 186 return render_view_host()->process(); | 186 return render_view_host()->GetProcess(); |
| 187 } | 187 } |
| 188 | 188 |
| 189 RenderViewHost* ExtensionHost::render_view_host() const { | 189 RenderViewHost* ExtensionHost::render_view_host() const { |
| 190 // TODO(mpcomplete): This can be NULL. How do we handle that? | 190 // TODO(mpcomplete): This can be NULL. How do we handle that? |
| 191 return render_view_host_; | 191 return render_view_host_; |
| 192 } | 192 } |
| 193 | 193 |
| 194 bool ExtensionHost::IsRenderViewLive() const { | 194 bool ExtensionHost::IsRenderViewLive() const { |
| 195 return render_view_host()->IsRenderViewLive(); | 195 return render_view_host()->IsRenderViewLive(); |
| 196 } | 196 } |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_INFOBAR) { | 466 extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_INFOBAR) { |
| 467 render_view_host->EnablePreferredSizeMode(); | 467 render_view_host->EnablePreferredSizeMode(); |
| 468 } | 468 } |
| 469 | 469 |
| 470 // If the host is bound to a browser, then extract its window id. | 470 // If the host is bound to a browser, then extract its window id. |
| 471 // Extensions hosted in ExternalTabContainer objects may not have | 471 // Extensions hosted in ExternalTabContainer objects may not have |
| 472 // an associated browser. | 472 // an associated browser. |
| 473 const Browser* browser = GetBrowser(); | 473 const Browser* browser = GetBrowser(); |
| 474 if (browser) { | 474 if (browser) { |
| 475 render_view_host->Send(new ExtensionMsg_UpdateBrowserWindowId( | 475 render_view_host->Send(new ExtensionMsg_UpdateBrowserWindowId( |
| 476 render_view_host->routing_id(), | 476 render_view_host->GetRoutingID(), |
| 477 ExtensionTabUtil::GetWindowId(browser))); | 477 ExtensionTabUtil::GetWindowId(browser))); |
| 478 } | 478 } |
| 479 } | 479 } |
| 480 | 480 |
| 481 void ExtensionHost::RenderViewDeleted(RenderViewHost* render_view_host) { | 481 void ExtensionHost::RenderViewDeleted(RenderViewHost* render_view_host) { |
| 482 // If our RenderViewHost is deleted, fall back to the host_contents' current | 482 // If our RenderViewHost is deleted, fall back to the host_contents' current |
| 483 // RVH. There is sometimes a small gap between the pending RVH being deleted | 483 // RVH. There is sometimes a small gap between the pending RVH being deleted |
| 484 // and RenderViewCreated being called, so we update it here. | 484 // and RenderViewCreated being called, so we update it here. |
| 485 if (render_view_host == render_view_host_) | 485 if (render_view_host == render_view_host_) |
| 486 render_view_host_ = host_contents_->GetRenderViewHost(); | 486 render_view_host_ = host_contents_->GetRenderViewHost(); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 browser::Navigate(¶ms); | 545 browser::Navigate(¶ms); |
| 546 } | 546 } |
| 547 | 547 |
| 548 | 548 |
| 549 void ExtensionHost::RenderViewReady() { | 549 void ExtensionHost::RenderViewReady() { |
| 550 content::NotificationService::current()->Notify( | 550 content::NotificationService::current()->Notify( |
| 551 chrome::NOTIFICATION_EXTENSION_HOST_CREATED, | 551 chrome::NOTIFICATION_EXTENSION_HOST_CREATED, |
| 552 content::Source<Profile>(profile_), | 552 content::Source<Profile>(profile_), |
| 553 content::Details<ExtensionHost>(this)); | 553 content::Details<ExtensionHost>(this)); |
| 554 } | 554 } |
| OLD | NEW |