Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(301)

Side by Side Diff: chrome/browser/tab_contents/thumbnail_generator.cc

Issue 10779042: Move notifications only used in chrome/ to chrome/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix oops Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/tab_contents/thumbnail_generator.h" 5 #include "chrome/browser/tab_contents/thumbnail_generator.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 } 178 }
179 179
180 void ThumbnailGenerator::StartThumbnailing(WebContents* web_contents) { 180 void ThumbnailGenerator::StartThumbnailing(WebContents* web_contents) {
181 content::WebContentsObserver::Observe(web_contents); 181 content::WebContentsObserver::Observe(web_contents);
182 182
183 if (registrar_.IsEmpty()) { 183 if (registrar_.IsEmpty()) {
184 // Even though we deal in RenderWidgetHosts, we only care about its 184 // Even though we deal in RenderWidgetHosts, we only care about its
185 // subclass, RenderViewHost when it is in a tab. We don't make thumbnails 185 // subclass, RenderViewHost when it is in a tab. We don't make thumbnails
186 // for RenderViewHosts that aren't in tabs, or RenderWidgetHosts that 186 // for RenderViewHosts that aren't in tabs, or RenderWidgetHosts that
187 // aren't views like select popups. 187 // aren't views like select popups.
188 registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB, 188 registrar_.Add(this,
189 content::NOTIFICATION_WEB_CONTENTS_RENDER_VIEW_HOST_CREATED,
189 content::Source<WebContents>(web_contents)); 190 content::Source<WebContents>(web_contents));
190 registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED, 191 registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED,
191 content::Source<WebContents>(web_contents)); 192 content::Source<WebContents>(web_contents));
192 web_contents_weak_factory_.reset( 193 web_contents_weak_factory_.reset(
193 new base::WeakPtrFactory<WebContents>(web_contents)); 194 new base::WeakPtrFactory<WebContents>(web_contents));
194 } 195 }
195 } 196 }
196 197
197 void ThumbnailGenerator::MonitorRenderer(RenderWidgetHost* renderer, 198 void ThumbnailGenerator::MonitorRenderer(RenderWidgetHost* renderer,
198 bool monitor) { 199 bool monitor) {
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 313
313 // We're done with the callback, and with the DIB, so delete both. 314 // We're done with the callback, and with the DIB, so delete both.
314 callback_map_.erase(item); 315 callback_map_.erase(item);
315 } 316 }
316 } 317 }
317 318
318 void ThumbnailGenerator::Observe(int type, 319 void ThumbnailGenerator::Observe(int type,
319 const content::NotificationSource& source, 320 const content::NotificationSource& source,
320 const content::NotificationDetails& details) { 321 const content::NotificationDetails& details) {
321 switch (type) { 322 switch (type) {
322 case content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB: { 323 case content::NOTIFICATION_WEB_CONTENTS_RENDER_VIEW_HOST_CREATED: {
323 // Install our observer for all new RVHs. 324 // Install our observer for all new RVHs.
324 RenderViewHost* renderer = 325 RenderViewHost* renderer =
325 content::Details<RenderViewHost>(details).ptr(); 326 content::Details<RenderViewHost>(details).ptr();
326 MonitorRenderer(renderer, true); 327 MonitorRenderer(renderer, true);
327 break; 328 break;
328 } 329 }
329 330
330 case content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED: 331 case content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED:
331 if (!*content::Details<bool>(details).ptr()) 332 if (!*content::Details<bool>(details).ptr())
332 WidgetHidden(content::Source<RenderWidgetHost>(source).ptr()); 333 WidgetHidden(content::Source<RenderWidgetHost>(source).ptr());
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 596
596 void ThumbnailGenerator::DidStartLoading() { 597 void ThumbnailGenerator::DidStartLoading() {
597 load_interrupted_ = false; 598 load_interrupted_ = false;
598 } 599 }
599 600
600 void ThumbnailGenerator::StopNavigation() { 601 void ThumbnailGenerator::StopNavigation() {
601 // This function gets called when the page loading is interrupted by the 602 // This function gets called when the page loading is interrupted by the
602 // stop button. 603 // stop button.
603 load_interrupted_ = true; 604 load_interrupted_ = true;
604 } 605 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698