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/tab_contents/background_contents.h" | 5 #include "chrome/browser/tab_contents/background_contents.h" |
6 | 6 |
7 #include "chrome/browser/background_contents_service.h" | 7 #include "chrome/browser/background_contents_service.h" |
8 #include "chrome/browser/browsing_instance.h" | 8 #include "chrome/browser/browsing_instance.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/renderer_host/render_view_host.h" | 10 #include "chrome/browser/renderer_host/render_view_host.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 if (!render_view_host_) // Will be null for unit tests. | 51 if (!render_view_host_) // Will be null for unit tests. |
52 return; | 52 return; |
53 Profile* profile = render_view_host_->process()->profile(); | 53 Profile* profile = render_view_host_->process()->profile(); |
54 NotificationService::current()->Notify( | 54 NotificationService::current()->Notify( |
55 NotificationType::BACKGROUND_CONTENTS_DELETED, | 55 NotificationType::BACKGROUND_CONTENTS_DELETED, |
56 Source<Profile>(profile), | 56 Source<Profile>(profile), |
57 Details<BackgroundContents>(this)); | 57 Details<BackgroundContents>(this)); |
58 render_view_host_->Shutdown(); // deletes render_view_host | 58 render_view_host_->Shutdown(); // deletes render_view_host |
59 } | 59 } |
60 | 60 |
| 61 BackgroundContents* BackgroundContents::GetAsBackgroundContents() { |
| 62 return this; |
| 63 } |
| 64 |
| 65 RenderViewHostDelegate::View* BackgroundContents::GetViewDelegate() { |
| 66 return this; |
| 67 } |
| 68 |
| 69 const GURL& BackgroundContents::GetURL() const { |
| 70 return url_; |
| 71 } |
| 72 |
61 ViewType::Type BackgroundContents::GetRenderViewType() const { | 73 ViewType::Type BackgroundContents::GetRenderViewType() const { |
62 return ViewType::BACKGROUND_CONTENTS; | 74 return ViewType::BACKGROUND_CONTENTS; |
63 } | 75 } |
64 | 76 |
65 int BackgroundContents::GetBrowserWindowID() const { | 77 int BackgroundContents::GetBrowserWindowID() const { |
66 return extension_misc::kUnknownWindowId; | 78 return extension_misc::kUnknownWindowId; |
67 } | 79 } |
68 | 80 |
69 void BackgroundContents::DidNavigate( | 81 void BackgroundContents::DidNavigate( |
70 RenderViewHost* render_view_host, | 82 RenderViewHost* render_view_host, |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 BackgroundContents* | 235 BackgroundContents* |
224 BackgroundContents::GetBackgroundContentsByID(int render_process_id, | 236 BackgroundContents::GetBackgroundContentsByID(int render_process_id, |
225 int render_view_id) { | 237 int render_view_id) { |
226 RenderViewHost* render_view_host = | 238 RenderViewHost* render_view_host = |
227 RenderViewHost::FromID(render_process_id, render_view_id); | 239 RenderViewHost::FromID(render_process_id, render_view_id); |
228 if (!render_view_host) | 240 if (!render_view_host) |
229 return NULL; | 241 return NULL; |
230 | 242 |
231 return render_view_host->delegate()->GetAsBackgroundContents(); | 243 return render_view_host->delegate()->GetAsBackgroundContents(); |
232 } | 244 } |
OLD | NEW |