| 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 #include "chrome/browser/bookmarks/bookmark_utils.h" | 5 #include "chrome/browser/bookmarks/bookmark_utils.h" |
| 6 | 6 |
| 7 #include "app/drag_drop_types.h" | 7 #include "app/drag_drop_types.h" |
| 8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
| 9 // TODO(port): Port these files. | 9 // TODO(port): Port these files. |
| 10 #if defined(OS_WIN) | 10 #if defined(OS_WIN) |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "chrome/browser/browser.h" | 21 #include "chrome/browser/browser.h" |
| 22 #include "chrome/browser/browser_list.h" | 22 #include "chrome/browser/browser_list.h" |
| 23 #include "chrome/browser/browser_window.h" | 23 #include "chrome/browser/browser_window.h" |
| 24 #include "chrome/browser/history/query_parser.h" | 24 #include "chrome/browser/history/query_parser.h" |
| 25 #include "chrome/browser/profile.h" | 25 #include "chrome/browser/profile.h" |
| 26 #include "chrome/browser/tab_contents/page_navigator.h" | 26 #include "chrome/browser/tab_contents/page_navigator.h" |
| 27 #include "chrome/browser/tab_contents/tab_contents.h" | 27 #include "chrome/browser/tab_contents/tab_contents.h" |
| 28 #include "chrome/common/notification_service.h" | 28 #include "chrome/common/notification_service.h" |
| 29 #include "chrome/common/pref_names.h" | 29 #include "chrome/common/pref_names.h" |
| 30 #include "chrome/common/pref_service.h" | 30 #include "chrome/common/pref_service.h" |
| 31 #include "grit/app_strings.h" |
| 31 #include "grit/chromium_strings.h" | 32 #include "grit/chromium_strings.h" |
| 32 #include "grit/generated_resources.h" | 33 #include "grit/generated_resources.h" |
| 33 #include "net/base/net_util.h" | 34 #include "net/base/net_util.h" |
| 34 #include "views/event.h" | 35 #include "views/event.h" |
| 35 | 36 |
| 36 using base::Time; | 37 using base::Time; |
| 37 | 38 |
| 38 namespace { | 39 namespace { |
| 39 | 40 |
| 40 // A PageNavigator implementation that creates a new Browser. This is used when | 41 // A PageNavigator implementation that creates a new Browser. This is used when |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 | 411 |
| 411 OSExchangeData data_wrapper(data); | 412 OSExchangeData data_wrapper(data); |
| 412 BookmarkDragData bookmark_data; | 413 BookmarkDragData bookmark_data; |
| 413 return bookmark_data.Read(data_wrapper); | 414 return bookmark_data.Read(data_wrapper); |
| 414 #else | 415 #else |
| 415 // TODO(port): Clipboard integration. | 416 // TODO(port): Clipboard integration. |
| 416 return false; | 417 return false; |
| 417 #endif | 418 #endif |
| 418 } | 419 } |
| 419 | 420 |
| 421 std::string GetNameForURL(const GURL& url) { |
| 422 if (url.is_valid()) { |
| 423 return WideToUTF8(net::GetSuggestedFilename( |
| 424 url, std::string(), std::string(), std::wstring())); |
| 425 } else { |
| 426 return l10n_util::GetStringUTF8(IDS_APP_UNTITLED_SHORTCUT_FILE_NAME); |
| 427 } |
| 428 } |
| 429 |
| 420 std::vector<const BookmarkNode*> GetMostRecentlyModifiedGroups( | 430 std::vector<const BookmarkNode*> GetMostRecentlyModifiedGroups( |
| 421 BookmarkModel* model, | 431 BookmarkModel* model, |
| 422 size_t max_count) { | 432 size_t max_count) { |
| 423 std::vector<const BookmarkNode*> nodes; | 433 std::vector<const BookmarkNode*> nodes; |
| 424 TreeNodeIterator<const BookmarkNode> iterator(model->root_node()); | 434 TreeNodeIterator<const BookmarkNode> iterator(model->root_node()); |
| 425 while (iterator.has_next()) { | 435 while (iterator.has_next()) { |
| 426 const BookmarkNode* parent = iterator.Next(); | 436 const BookmarkNode* parent = iterator.Next(); |
| 427 if (parent->is_folder() && parent->date_group_modified() > base::Time()) { | 437 if (parent->is_folder() && parent->date_group_modified() > base::Time()) { |
| 428 if (max_count == 0) { | 438 if (max_count == 0) { |
| 429 nodes.push_back(parent); | 439 nodes.push_back(parent); |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 | 625 |
| 616 // Formerly in BookmarkTableView | 626 // Formerly in BookmarkTableView |
| 617 prefs->RegisterIntegerPref(prefs::kBookmarkTableNameWidth1, -1); | 627 prefs->RegisterIntegerPref(prefs::kBookmarkTableNameWidth1, -1); |
| 618 prefs->RegisterIntegerPref(prefs::kBookmarkTableURLWidth1, -1); | 628 prefs->RegisterIntegerPref(prefs::kBookmarkTableURLWidth1, -1); |
| 619 prefs->RegisterIntegerPref(prefs::kBookmarkTableNameWidth2, -1); | 629 prefs->RegisterIntegerPref(prefs::kBookmarkTableNameWidth2, -1); |
| 620 prefs->RegisterIntegerPref(prefs::kBookmarkTableURLWidth2, -1); | 630 prefs->RegisterIntegerPref(prefs::kBookmarkTableURLWidth2, -1); |
| 621 prefs->RegisterIntegerPref(prefs::kBookmarkTablePathWidth, -1); | 631 prefs->RegisterIntegerPref(prefs::kBookmarkTablePathWidth, -1); |
| 622 } | 632 } |
| 623 | 633 |
| 624 } // namespace bookmark_utils | 634 } // namespace bookmark_utils |
| OLD | NEW |