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/prerender/prerender_tab_helper.h" | 5 #include "chrome/browser/prerender/prerender_tab_helper.h" |
6 | 6 |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
9 #include "base/time.h" | 9 #include "base/time.h" |
10 #include "chrome/browser/prerender/prerender_histograms.h" | 10 #include "chrome/browser/prerender/prerender_histograms.h" |
11 #include "chrome/browser/prerender/prerender_manager.h" | 11 #include "chrome/browser/prerender/prerender_manager.h" |
12 #include "chrome/browser/prerender/prerender_manager_factory.h" | 12 #include "chrome/browser/prerender/prerender_manager_factory.h" |
13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" | 14 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" |
15 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 15 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
16 #include "content/public/browser/notification_service.h" | 16 #include "content/public/browser/notification_service.h" |
17 #include "content/public/browser/notification_types.h" | 17 #include "content/public/browser/notification_types.h" |
18 #include "content/public/browser/render_view_host.h" | 18 #include "content/public/browser/render_view_host.h" |
19 #include "content/public/browser/resource_request_details.h" | 19 #include "content/public/browser/resource_request_details.h" |
20 #include "content/public/browser/web_contents.h" | 20 #include "content/public/browser/web_contents.h" |
21 #include "content/public/browser/web_contents_view.h" | 21 #include "content/public/browser/web_contents_view.h" |
22 #include "skia/ext/platform_canvas.h" | 22 #include "skia/ext/platform_canvas.h" |
23 #include "third_party/skia/include/core/SkBitmap.h" | 23 #include "third_party/skia/include/core/SkBitmap.h" |
24 #include "ui/gfx/rect.h" | 24 #include "ui/gfx/rect.h" |
25 | 25 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 // Bitmap of what the last swapped in prerendered tab looked like at swapin, | 124 // Bitmap of what the last swapped in prerendered tab looked like at swapin, |
125 // and the WebContents that it was swapped into. | 125 // and the WebContents that it was swapped into. |
126 scoped_ptr<SkBitmap> bitmap_; | 126 scoped_ptr<SkBitmap> bitmap_; |
127 WebContents* bitmap_web_contents_; | 127 WebContents* bitmap_web_contents_; |
128 | 128 |
129 base::WeakPtrFactory<PixelStats> weak_factory_; | 129 base::WeakPtrFactory<PixelStats> weak_factory_; |
130 | 130 |
131 PrerenderTabHelper* tab_helper_; | 131 PrerenderTabHelper* tab_helper_; |
132 }; | 132 }; |
133 | 133 |
134 PrerenderTabHelper::PrerenderTabHelper(TabContentsWrapper* tab) | 134 PrerenderTabHelper::PrerenderTabHelper(TabContents* tab) |
135 : content::WebContentsObserver(tab->web_contents()), | 135 : content::WebContentsObserver(tab->web_contents()), |
136 pixel_stats_(new PixelStats(this)), | 136 pixel_stats_(new PixelStats(this)), |
137 tab_(tab) { | 137 tab_(tab) { |
138 notification_registrar_.Add( | 138 notification_registrar_.Add( |
139 this, content::NOTIFICATION_RESOURCE_RECEIVED_REDIRECT, | 139 this, content::NOTIFICATION_RESOURCE_RECEIVED_REDIRECT, |
140 content::Source<content::WebContents>(web_contents())); | 140 content::Source<content::WebContents>(web_contents())); |
141 } | 141 } |
142 | 142 |
143 PrerenderTabHelper::~PrerenderTabHelper() { | 143 PrerenderTabHelper::~PrerenderTabHelper() { |
144 } | 144 } |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 break; | 267 break; |
268 } | 268 } |
269 | 269 |
270 default: | 270 default: |
271 NOTREACHED() << "Unexpected notification sent."; | 271 NOTREACHED() << "Unexpected notification sent."; |
272 break; | 272 break; |
273 } | 273 } |
274 } | 274 } |
275 | 275 |
276 } // namespace prerender | 276 } // namespace prerender |
OLD | NEW |