| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 void HistoryService::ScheduleTask(SchedulePriority priority, | 608 void HistoryService::ScheduleTask(SchedulePriority priority, |
| 609 Task* task) { | 609 Task* task) { |
| 610 // FIXME(brettw) do prioritization. | 610 // FIXME(brettw) do prioritization. |
| 611 thread_->message_loop()->PostTask(FROM_HERE, task); | 611 thread_->message_loop()->PostTask(FROM_HERE, task); |
| 612 } | 612 } |
| 613 | 613 |
| 614 bool HistoryService::CanAddURL(const GURL& url) const { | 614 bool HistoryService::CanAddURL(const GURL& url) const { |
| 615 if (!url.is_valid()) | 615 if (!url.is_valid()) |
| 616 return false; | 616 return false; |
| 617 | 617 |
| 618 // We allow chrome://* URLs so that they will be added to history and |
| 619 // autocomplete suggestions. |
| 618 if (url.SchemeIs(chrome::kJavaScriptScheme) || | 620 if (url.SchemeIs(chrome::kJavaScriptScheme) || |
| 619 url.SchemeIs(chrome::kChromeUIScheme) || | |
| 620 url.SchemeIs(chrome::kViewSourceScheme) || | 621 url.SchemeIs(chrome::kViewSourceScheme) || |
| 621 url.SchemeIs(chrome::kChromeInternalScheme) || | 622 url.SchemeIs(chrome::kChromeInternalScheme) || |
| 622 url.SchemeIs(chrome::kPrintScheme)) | 623 url.SchemeIs(chrome::kPrintScheme)) |
| 623 return false; | 624 return false; |
| 624 | 625 |
| 625 if (url.SchemeIs(chrome::kAboutScheme)) { | 626 if (url.SchemeIs(chrome::kAboutScheme)) { |
| 626 std::string path = url.path(); | 627 if (LowerCaseEqualsASCII(url.path(), "blank")) |
| 627 if (path.empty() || LowerCaseEqualsASCII(path, "blank")) | |
| 628 return false; | 628 return false; |
| 629 // We allow all other about URLs since the user may like to see things | 629 // We allow all other about URLs since the user may like to see things |
| 630 // like "about:memory" or "about:histograms" in their history and | 630 // like "about:memory" or "about:histograms" in their history and |
| 631 // autocomplete. | 631 // autocomplete. |
| 632 } | 632 } |
| 633 | 633 |
| 634 return true; | 634 return true; |
| 635 } | 635 } |
| 636 | 636 |
| 637 void HistoryService::SetInMemoryBackend( | 637 void HistoryService::SetInMemoryBackend( |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 NotificationService::current()->Notify(type, source, det); | 689 NotificationService::current()->Notify(type, source, det); |
| 690 } | 690 } |
| 691 | 691 |
| 692 void HistoryService::OnDBLoaded() { | 692 void HistoryService::OnDBLoaded() { |
| 693 LOG(INFO) << "History backend finished loading"; | 693 LOG(INFO) << "History backend finished loading"; |
| 694 backend_loaded_ = true; | 694 backend_loaded_ = true; |
| 695 NotificationService::current()->Notify(NotificationType::HISTORY_LOADED, | 695 NotificationService::current()->Notify(NotificationType::HISTORY_LOADED, |
| 696 Source<Profile>(profile_), | 696 Source<Profile>(profile_), |
| 697 Details<HistoryService>(this)); | 697 Details<HistoryService>(this)); |
| 698 } | 698 } |
| OLD | NEW |