| 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 // The history system runs on a background thread so that potentially slow | 5 // The history system runs on a background thread so that potentially slow |
| 6 // database operations don't delay the browser. This backend processing is | 6 // database operations don't delay the browser. This backend processing is |
| 7 // represented by HistoryBackend. The HistoryService's job is to dispatch to | 7 // represented by HistoryBackend. The HistoryService's job is to dispatch to |
| 8 // that thread. | 8 // that thread. |
| 9 // | 9 // |
| 10 // Main thread History thread | 10 // Main thread History thread |
| (...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 697 // TODO: We should allow kChromeUIScheme URLs if they have been explicitly | 697 // TODO: We should allow kChromeUIScheme URLs if they have been explicitly |
| 698 // typed. Right now, however, these are marked as typed even when triggered | 698 // typed. Right now, however, these are marked as typed even when triggered |
| 699 // by a shortcut or menu action. | 699 // by a shortcut or menu action. |
| 700 if (url.SchemeIs(chrome::kJavaScriptScheme) || | 700 if (url.SchemeIs(chrome::kJavaScriptScheme) || |
| 701 url.SchemeIs(chrome::kChromeDevToolsScheme) || | 701 url.SchemeIs(chrome::kChromeDevToolsScheme) || |
| 702 url.SchemeIs(chrome::kChromeUIScheme) || | 702 url.SchemeIs(chrome::kChromeUIScheme) || |
| 703 url.SchemeIs(chrome::kViewSourceScheme) || | 703 url.SchemeIs(chrome::kViewSourceScheme) || |
| 704 url.SchemeIs(chrome::kChromeInternalScheme)) | 704 url.SchemeIs(chrome::kChromeInternalScheme)) |
| 705 return false; | 705 return false; |
| 706 | 706 |
| 707 // Allow all about: and chrome: URLs except about:blank, since the user may | 707 if (url.SchemeIs(chrome::kAboutScheme)) { |
| 708 // like to see "chrome://memory/", etc. in their history and autocomplete. | 708 if (LowerCaseEqualsASCII(url.path(), "blank")) |
| 709 if (url == GURL(chrome::kAboutBlankURL)) | 709 return false; |
| 710 return false; | 710 // We allow all other about URLs since the user may like to see things |
| 711 // like "about:memory" or "about:histograms" in their history and |
| 712 // autocomplete. |
| 713 } |
| 711 | 714 |
| 712 return true; | 715 return true; |
| 713 } | 716 } |
| 714 | 717 |
| 715 void HistoryService::SetInMemoryBackend( | 718 void HistoryService::SetInMemoryBackend( |
| 716 history::InMemoryHistoryBackend* mem_backend) { | 719 history::InMemoryHistoryBackend* mem_backend) { |
| 717 DCHECK(!in_memory_backend_.get()) << "Setting mem DB twice"; | 720 DCHECK(!in_memory_backend_.get()) << "Setting mem DB twice"; |
| 718 in_memory_backend_.reset(mem_backend); | 721 in_memory_backend_.reset(mem_backend); |
| 719 | 722 |
| 720 // The database requires additional initialization once we own it. | 723 // The database requires additional initialization once we own it. |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 810 history::TopSites* ts = profile_->GetTopSitesWithoutCreating(); | 813 history::TopSites* ts = profile_->GetTopSitesWithoutCreating(); |
| 811 if (ts) | 814 if (ts) |
| 812 ts->MigrateFromHistory(); | 815 ts->MigrateFromHistory(); |
| 813 } | 816 } |
| 814 } | 817 } |
| 815 | 818 |
| 816 void HistoryService::OnTopSitesReady() { | 819 void HistoryService::OnTopSitesReady() { |
| 817 ScheduleAndForget(PRIORITY_NORMAL, | 820 ScheduleAndForget(PRIORITY_NORMAL, |
| 818 &HistoryBackend::MigrateThumbnailsDatabase); | 821 &HistoryBackend::MigrateThumbnailsDatabase); |
| 819 } | 822 } |
| OLD | NEW |