| 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/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 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 // web_contents() can be NULL, if StartThumbnailing() is not called, but | 407 // web_contents() can be NULL, if StartThumbnailing() is not called, but |
| 408 // MonitorRenderer() is called. The use case is found in | 408 // MonitorRenderer() is called. The use case is found in |
| 409 // chrome/test/base/ui_test_utils.cc. | 409 // chrome/test/base/ui_test_utils.cc. |
| 410 if (!web_contents()) | 410 if (!web_contents()) |
| 411 return; | 411 return; |
| 412 UpdateThumbnailIfNecessary(web_contents()); | 412 UpdateThumbnailIfNecessary(web_contents()); |
| 413 } | 413 } |
| 414 | 414 |
| 415 void ThumbnailGenerator::WebContentsDisconnected(WebContents* contents) { | 415 void ThumbnailGenerator::WebContentsDisconnected(WebContents* contents) { |
| 416 // Go through the existing callbacks, and find any that have the | 416 // Go through the existing callbacks, and find any that have the |
| 417 // same renderer as this TabContents and remove them so they don't | 417 // same renderer as this WebContents and remove them so they don't |
| 418 // hang around. | 418 // hang around. |
| 419 ThumbnailCallbackMap::iterator iterator = callback_map_.begin(); | 419 ThumbnailCallbackMap::iterator iterator = callback_map_.begin(); |
| 420 RenderWidgetHost* renderer = contents->GetRenderViewHost(); | 420 RenderWidgetHost* renderer = contents->GetRenderViewHost(); |
| 421 while (iterator != callback_map_.end()) { | 421 while (iterator != callback_map_.end()) { |
| 422 if (iterator->second->renderer == renderer) { | 422 if (iterator->second->renderer == renderer) { |
| 423 ThumbnailCallbackMap::iterator nuked = iterator; | 423 ThumbnailCallbackMap::iterator nuked = iterator; |
| 424 ++iterator; | 424 ++iterator; |
| 425 callback_map_.erase(nuked); | 425 callback_map_.erase(nuked); |
| 426 continue; | 426 continue; |
| 427 } | 427 } |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 | 611 |
| 612 void ThumbnailGenerator::DidStartLoading() { | 612 void ThumbnailGenerator::DidStartLoading() { |
| 613 load_interrupted_ = false; | 613 load_interrupted_ = false; |
| 614 } | 614 } |
| 615 | 615 |
| 616 void ThumbnailGenerator::StopNavigation() { | 616 void ThumbnailGenerator::StopNavigation() { |
| 617 // This function gets called when the page loading is interrupted by the | 617 // This function gets called when the page loading is interrupted by the |
| 618 // stop button. | 618 // stop button. |
| 619 load_interrupted_ = true; | 619 load_interrupted_ = true; |
| 620 } | 620 } |
| OLD | NEW |