| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/extensions/extension_message_service.h" | 8 #include "chrome/browser/extensions/extension_message_service.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/renderer_preferences_util.h" | 10 #include "chrome/browser/renderer_preferences_util.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 } | 67 } |
| 68 | 68 |
| 69 const GURL& BackgroundContents::GetURL() const { | 69 const GURL& BackgroundContents::GetURL() const { |
| 70 return url_; | 70 return url_; |
| 71 } | 71 } |
| 72 | 72 |
| 73 ViewType::Type BackgroundContents::GetRenderViewType() const { | 73 ViewType::Type BackgroundContents::GetRenderViewType() const { |
| 74 return ViewType::BACKGROUND_CONTENTS; | 74 return ViewType::BACKGROUND_CONTENTS; |
| 75 } | 75 } |
| 76 | 76 |
| 77 int BackgroundContents::GetBrowserWindowID() const { | |
| 78 return extension_misc::kUnknownWindowId; | |
| 79 } | |
| 80 | |
| 81 void BackgroundContents::DidNavigate( | 77 void BackgroundContents::DidNavigate( |
| 82 RenderViewHost* render_view_host, | 78 RenderViewHost* render_view_host, |
| 83 const ViewHostMsg_FrameNavigate_Params& params) { | 79 const ViewHostMsg_FrameNavigate_Params& params) { |
| 84 // We only care when the outer frame changes. | 80 // We only care when the outer frame changes. |
| 85 if (!PageTransition::IsMainFrame(params.transition)) | 81 if (!PageTransition::IsMainFrame(params.transition)) |
| 86 return; | 82 return; |
| 87 | 83 |
| 88 // Note: because BackgroundContents are only available to extension apps, | 84 // Note: because BackgroundContents are only available to extension apps, |
| 89 // navigation is limited to urls within the app's extent. This is enforced in | 85 // navigation is limited to urls within the app's extent. This is enforced in |
| 90 // RenderView::decidePolicyForNaviation. If BackgroundContents become | 86 // RenderView::decidePolicyForNaviation. If BackgroundContents become |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 BackgroundContents* | 254 BackgroundContents* |
| 259 BackgroundContents::GetBackgroundContentsByID(int render_process_id, | 255 BackgroundContents::GetBackgroundContentsByID(int render_process_id, |
| 260 int render_view_id) { | 256 int render_view_id) { |
| 261 RenderViewHost* render_view_host = | 257 RenderViewHost* render_view_host = |
| 262 RenderViewHost::FromID(render_process_id, render_view_id); | 258 RenderViewHost::FromID(render_process_id, render_view_id); |
| 263 if (!render_view_host) | 259 if (!render_view_host) |
| 264 return NULL; | 260 return NULL; |
| 265 | 261 |
| 266 return render_view_host->delegate()->GetAsBackgroundContents(); | 262 return render_view_host->delegate()->GetAsBackgroundContents(); |
| 267 } | 263 } |
| OLD | NEW |