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/background_contents_service.h" | 7 #include "chrome/browser/background/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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 } | 75 } |
76 | 76 |
77 content::ViewType BackgroundContents::GetRenderViewType() const { | 77 content::ViewType BackgroundContents::GetRenderViewType() const { |
78 return chrome::VIEW_TYPE_BACKGROUND_CONTENTS; | 78 return chrome::VIEW_TYPE_BACKGROUND_CONTENTS; |
79 } | 79 } |
80 | 80 |
81 void BackgroundContents::DidNavigate( | 81 void BackgroundContents::DidNavigate( |
82 RenderViewHost* render_view_host, | 82 RenderViewHost* render_view_host, |
83 const ViewHostMsg_FrameNavigate_Params& params) { | 83 const ViewHostMsg_FrameNavigate_Params& params) { |
84 // We only care when the outer frame changes. | 84 // We only care when the outer frame changes. |
85 if (!PageTransition::IsMainFrame(params.transition)) | 85 if (!content::PageTransitionIsMainFrame(params.transition)) |
86 return; | 86 return; |
87 | 87 |
88 // Note: because BackgroundContents are only available to extension apps, | 88 // Note: because BackgroundContents are only available to extension apps, |
89 // navigation is limited to urls within the app's extent. This is enforced in | 89 // navigation is limited to urls within the app's extent. This is enforced in |
90 // RenderView::decidePolicyForNaviation. If BackgroundContents become | 90 // RenderView::decidePolicyForNaviation. If BackgroundContents become |
91 // available as a part of the web platform, it probably makes sense to have | 91 // available as a part of the web platform, it probably makes sense to have |
92 // some way to scope navigation of a background page to its opener's security | 92 // some way to scope navigation of a background page to its opener's security |
93 // origin. Note: if the first navigation is to a URL outside the app's | 93 // origin. Note: if the first navigation is to a URL outside the app's |
94 // extent a background page will be opened but will remain at about:blank. | 94 // extent a background page will be opened but will remain at about:blank. |
95 url_ = params.url; | 95 url_ = params.url; |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 BackgroundContents* | 249 BackgroundContents* |
250 BackgroundContents::GetBackgroundContentsByID(int render_process_id, | 250 BackgroundContents::GetBackgroundContentsByID(int render_process_id, |
251 int render_view_id) { | 251 int render_view_id) { |
252 RenderViewHost* render_view_host = | 252 RenderViewHost* render_view_host = |
253 RenderViewHost::FromID(render_process_id, render_view_id); | 253 RenderViewHost::FromID(render_process_id, render_view_id); |
254 if (!render_view_host) | 254 if (!render_view_host) |
255 return NULL; | 255 return NULL; |
256 | 256 |
257 return render_view_host->delegate()->GetAsBackgroundContents(); | 257 return render_view_host->delegate()->GetAsBackgroundContents(); |
258 } | 258 } |
OLD | NEW |