| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/instant/instant_service.h" | 5 #include "chrome/browser/instant/instant_service.h" |
| 6 | 6 |
| 7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
| 8 #include "chrome/browser/history/history_notifications.h" | 8 #include "chrome/browser/history/history_notifications.h" |
| 9 #include "chrome/browser/instant/instant_io_context.h" | 9 #include "chrome/browser/instant/instant_io_context.h" |
| 10 #include "chrome/browser/instant/instant_service_factory.h" | 10 #include "chrome/browser/instant/instant_service_factory.h" |
| 11 #include "chrome/browser/instant/local_ntp_source.h" |
| 11 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/browser/ui/webui/ntp/thumbnail_source.h" | 13 #include "chrome/browser/ui/webui/ntp/thumbnail_source.h" |
| 13 #include "chrome/common/chrome_notification_types.h" | 14 #include "chrome/common/chrome_notification_types.h" |
| 14 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
| 15 #include "content/public/browser/notification_service.h" | 16 #include "content/public/browser/notification_service.h" |
| 16 #include "content/public/browser/notification_types.h" | 17 #include "content/public/browser/notification_types.h" |
| 17 #include "content/public/browser/render_process_host.h" | 18 #include "content/public/browser/render_process_host.h" |
| 18 #include "content/public/browser/url_data_source.h" | 19 #include "content/public/browser/url_data_source.h" |
| 19 #include "googleurl/src/gurl.h" | 20 #include "googleurl/src/gurl.h" |
| 20 #include "net/url_request/url_request.h" | 21 #include "net/url_request/url_request.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 instant_io_context_ = new InstantIOContext(); | 54 instant_io_context_ = new InstantIOContext(); |
| 54 | 55 |
| 55 if (profile_ && profile_->GetResourceContext()) { | 56 if (profile_ && profile_->GetResourceContext()) { |
| 56 BrowserThread::PostTask( | 57 BrowserThread::PostTask( |
| 57 BrowserThread::IO, FROM_HERE, | 58 BrowserThread::IO, FROM_HERE, |
| 58 base::Bind(&InstantIOContext::SetUserDataOnIO, | 59 base::Bind(&InstantIOContext::SetUserDataOnIO, |
| 59 profile->GetResourceContext(), instant_io_context_)); | 60 profile->GetResourceContext(), instant_io_context_)); |
| 60 } | 61 } |
| 61 | 62 |
| 62 content::URLDataSource::Add(profile, new ThumbnailSource(profile)); | 63 content::URLDataSource::Add(profile, new ThumbnailSource(profile)); |
| 64 content::URLDataSource::Add(profile, new LocalNTPSource()); |
| 63 } | 65 } |
| 64 | 66 |
| 65 InstantService::~InstantService() { | 67 InstantService::~InstantService() { |
| 66 } | 68 } |
| 67 | 69 |
| 68 // static | 70 // static |
| 69 const std::string InstantService::MaybeTranslateInstantPathOnUI( | 71 const std::string InstantService::MaybeTranslateInstantPathOnUI( |
| 70 Profile* profile, const std::string& path) { | 72 Profile* profile, const std::string& path) { |
| 71 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 73 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 72 InstantService* instant_service = | 74 InstantService* instant_service = |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 url_to_most_visited_item_id_map_.find(*it); | 232 url_to_most_visited_item_id_map_.find(*it); |
| 231 if (item != url_to_most_visited_item_id_map_.end()) { | 233 if (item != url_to_most_visited_item_id_map_.end()) { |
| 232 uint64 most_visited_item_id = item->second; | 234 uint64 most_visited_item_id = item->second; |
| 233 url_to_most_visited_item_id_map_.erase(item); | 235 url_to_most_visited_item_id_map_.erase(item); |
| 234 most_visited_item_id_to_url_map_.erase( | 236 most_visited_item_id_to_url_map_.erase( |
| 235 most_visited_item_id_to_url_map_.find(most_visited_item_id)); | 237 most_visited_item_id_to_url_map_.find(most_visited_item_id)); |
| 236 deleted_ids->push_back(most_visited_item_id); | 238 deleted_ids->push_back(most_visited_item_id); |
| 237 } | 239 } |
| 238 } | 240 } |
| 239 } | 241 } |
| OLD | NEW |