| 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/browser/bookmarks/bookmark_utils.h" | 5 #include "chrome/browser/bookmarks/bookmark_utils.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| 11 #include "base/i18n/case_conversion.h" | 11 #include "base/i18n/case_conversion.h" |
| 12 #include "base/string16.h" | 12 #include "base/string16.h" |
| 13 #include "base/string_number_conversions.h" | 13 #include "base/string_number_conversions.h" |
| 14 #include "base/time.h" | 14 #include "base/time.h" |
| 15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
| 16 #include "chrome/browser/bookmarks/bookmark_model.h" | 16 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 17 #include "chrome/browser/bookmarks/bookmark_node_data.h" | 17 #include "chrome/browser/bookmarks/bookmark_node_data.h" |
| 18 #include "chrome/browser/history/query_parser.h" | 18 #include "chrome/browser/history/query_parser.h" |
| 19 #include "chrome/browser/platform_util.h" | 19 #include "chrome/browser/platform_util.h" |
| 20 #include "chrome/browser/prefs/pref_service.h" | 20 #include "chrome/browser/prefs/pref_service.h" |
| 21 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
| 22 #include "chrome/browser/ui/browser.h" | 22 #include "chrome/browser/ui/browser.h" |
| 23 #include "chrome/browser/ui/browser_list.h" | 23 #include "chrome/browser/ui/browser_list.h" |
| 24 #include "chrome/browser/ui/browser_window.h" | 24 #include "chrome/browser/ui/browser_window.h" |
| 25 #include "chrome/common/chrome_notification_types.h" |
| 25 #include "chrome/common/pref_names.h" | 26 #include "chrome/common/pref_names.h" |
| 26 #include "content/browser/tab_contents/page_navigator.h" | 27 #include "content/browser/tab_contents/page_navigator.h" |
| 27 #include "content/browser/tab_contents/tab_contents.h" | 28 #include "content/browser/tab_contents/tab_contents.h" |
| 28 #include "content/common/notification_service.h" | 29 #include "content/common/notification_service.h" |
| 29 #include "grit/chromium_strings.h" | 30 #include "grit/chromium_strings.h" |
| 30 #include "grit/generated_resources.h" | 31 #include "grit/generated_resources.h" |
| 31 #include "grit/ui_strings.h" | 32 #include "grit/ui_strings.h" |
| 32 #include "net/base/net_util.h" | 33 #include "net/base/net_util.h" |
| 33 #include "ui/base/dragdrop/drag_drop_types.h" | 34 #include "ui/base/dragdrop/drag_drop_types.h" |
| 34 #include "ui/base/l10n/l10n_util.h" | 35 #include "ui/base/l10n/l10n_util.h" |
| (...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 618 PrefService* prefs = profile->GetPrefs(); | 619 PrefService* prefs = profile->GetPrefs(); |
| 619 const bool always_show = !prefs->GetBoolean(prefs::kShowBookmarkBar); | 620 const bool always_show = !prefs->GetBoolean(prefs::kShowBookmarkBar); |
| 620 | 621 |
| 621 // The user changed when the bookmark bar is shown, update the preferences. | 622 // The user changed when the bookmark bar is shown, update the preferences. |
| 622 prefs->SetBoolean(prefs::kShowBookmarkBar, always_show); | 623 prefs->SetBoolean(prefs::kShowBookmarkBar, always_show); |
| 623 prefs->ScheduleSavePersistentPrefs(); | 624 prefs->ScheduleSavePersistentPrefs(); |
| 624 | 625 |
| 625 // And notify the notification service. | 626 // And notify the notification service. |
| 626 Source<Profile> source(profile); | 627 Source<Profile> source(profile); |
| 627 NotificationService::current()->Notify( | 628 NotificationService::current()->Notify( |
| 628 NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED, | 629 chrome::NOTIFICATION_BOOKMARK_BAR_VISIBILITY_PREF_CHANGED, |
| 629 source, | 630 source, |
| 630 NotificationService::NoDetails()); | 631 NotificationService::NoDetails()); |
| 631 } | 632 } |
| 632 | 633 |
| 633 void RegisterUserPrefs(PrefService* prefs) { | 634 void RegisterUserPrefs(PrefService* prefs) { |
| 634 prefs->RegisterBooleanPref(prefs::kShowBookmarkBar, | 635 prefs->RegisterBooleanPref(prefs::kShowBookmarkBar, |
| 635 false, | 636 false, |
| 636 PrefService::SYNCABLE_PREF); | 637 PrefService::SYNCABLE_PREF); |
| 637 prefs->RegisterBooleanPref(prefs::kEditBookmarksEnabled, | 638 prefs->RegisterBooleanPref(prefs::kEditBookmarksEnabled, |
| 638 true, | 639 true, |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 698 return true; | 699 return true; |
| 699 | 700 |
| 700 for (int i = 0; i < node->child_count(); ++i) { | 701 for (int i = 0; i < node->child_count(); ++i) { |
| 701 if (NodeHasURLs(node->GetChild(i))) | 702 if (NodeHasURLs(node->GetChild(i))) |
| 702 return true; | 703 return true; |
| 703 } | 704 } |
| 704 return false; | 705 return false; |
| 705 } | 706 } |
| 706 | 707 |
| 707 } // namespace bookmark_utils | 708 } // namespace bookmark_utils |
| OLD | NEW |