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/renderer/chrome_render_view_observer.h" | 5 #include "chrome/renderer/chrome_render_view_observer.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback_old.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
13 #include "base/string_util.h" | 13 #include "base/string_util.h" |
14 #include "chrome/common/chrome_constants.h" | 14 #include "chrome/common/chrome_constants.h" |
15 #include "chrome/common/chrome_switches.h" | 15 #include "chrome/common/chrome_switches.h" |
16 #include "chrome/common/icon_messages.h" | 16 #include "chrome/common/icon_messages.h" |
17 #include "chrome/common/render_messages.h" | 17 #include "chrome/common/render_messages.h" |
18 #include "chrome/common/thumbnail_score.h" | 18 #include "chrome/common/thumbnail_score.h" |
(...skipping 979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
998 const GURL& image_url, | 998 const GURL& image_url, |
999 int image_size) { | 999 int image_size) { |
1000 // Make sure webview was not shut down. | 1000 // Make sure webview was not shut down. |
1001 if (!render_view()->GetWebView()) | 1001 if (!render_view()->GetWebView()) |
1002 return false; | 1002 return false; |
1003 // Create an image resource fetcher and assign it with a call back object. | 1003 // Create an image resource fetcher and assign it with a call back object. |
1004 image_fetchers_.push_back(linked_ptr<ImageResourceFetcher>( | 1004 image_fetchers_.push_back(linked_ptr<ImageResourceFetcher>( |
1005 new ImageResourceFetcher( | 1005 new ImageResourceFetcher( |
1006 image_url, render_view()->GetWebView()->mainFrame(), id, image_size, | 1006 image_url, render_view()->GetWebView()->mainFrame(), id, image_size, |
1007 WebURLRequest::TargetIsFavicon, | 1007 WebURLRequest::TargetIsFavicon, |
1008 NewCallback(this, &ChromeRenderViewObserver::DidDownloadFavicon)))); | 1008 base::Bind(&ChromeRenderViewObserver::DidDownloadFavicon, |
| 1009 base::Unretained(this))))); |
1009 return true; | 1010 return true; |
1010 } | 1011 } |
1011 | 1012 |
1012 void ChromeRenderViewObserver::DidDownloadFavicon( | 1013 void ChromeRenderViewObserver::DidDownloadFavicon( |
1013 ImageResourceFetcher* fetcher, const SkBitmap& image) { | 1014 ImageResourceFetcher* fetcher, const SkBitmap& image) { |
1014 // Notify requester of image download status. | 1015 // Notify requester of image download status. |
1015 Send(new IconHostMsg_DidDownloadFavicon(routing_id(), | 1016 Send(new IconHostMsg_DidDownloadFavicon(routing_id(), |
1016 fetcher->id(), | 1017 fetcher->id(), |
1017 fetcher->image_url(), | 1018 fetcher->image_url(), |
1018 image.isNull(), | 1019 image.isNull(), |
(...skipping 22 matching lines...) Expand all Loading... |
1041 reinterpret_cast<const unsigned char*>(&data[0]); | 1042 reinterpret_cast<const unsigned char*>(&data[0]); |
1042 | 1043 |
1043 return decoder.Decode(src_data, data.size()); | 1044 return decoder.Decode(src_data, data.size()); |
1044 } | 1045 } |
1045 return SkBitmap(); | 1046 return SkBitmap(); |
1046 } | 1047 } |
1047 | 1048 |
1048 bool ChromeRenderViewObserver::IsStrictSecurityHost(const std::string& host) { | 1049 bool ChromeRenderViewObserver::IsStrictSecurityHost(const std::string& host) { |
1049 return (strict_security_hosts_.find(host) != strict_security_hosts_.end()); | 1050 return (strict_security_hosts_.find(host) != strict_security_hosts_.end()); |
1050 } | 1051 } |
OLD | NEW |