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 "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/time.h" | 9 #include "base/time.h" |
10 #include "chrome/browser/bookmarks/bookmark_drag_data.h" | 10 #include "chrome/browser/bookmarks/bookmark_drag_data.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 const GURL& referrer, | 51 const GURL& referrer, |
52 WindowOpenDisposition disposition, | 52 WindowOpenDisposition disposition, |
53 PageTransition::Type transition) { | 53 PageTransition::Type transition) { |
54 if (!browser_) { | 54 if (!browser_) { |
55 Profile* profile = (disposition == OFF_THE_RECORD) ? | 55 Profile* profile = (disposition == OFF_THE_RECORD) ? |
56 profile_->GetOffTheRecordProfile() : profile_; | 56 profile_->GetOffTheRecordProfile() : profile_; |
57 browser_ = Browser::Create(profile); | 57 browser_ = Browser::Create(profile); |
58 // Always open the first tab in the foreground. | 58 // Always open the first tab in the foreground. |
59 disposition = NEW_FOREGROUND_TAB; | 59 disposition = NEW_FOREGROUND_TAB; |
60 } | 60 } |
61 browser_->OpenURLFromTab(NULL, url, referrer, NEW_FOREGROUND_TAB, transition
); | 61 browser_->OpenURLFromTab(NULL, url, referrer, NEW_FOREGROUND_TAB, |
| 62 transition); |
62 } | 63 } |
63 | 64 |
64 private: | 65 private: |
65 Profile* profile_; | 66 Profile* profile_; |
66 Browser* browser_; | 67 Browser* browser_; |
67 | 68 |
68 DISALLOW_COPY_AND_ASSIGN(NewBrowserPageNavigator); | 69 DISALLOW_COPY_AND_ASSIGN(NewBrowserPageNavigator); |
69 }; | 70 }; |
70 | 71 |
71 void CloneDragDataImpl(BookmarkModel* model, | 72 void CloneDragDataImpl(BookmarkModel* model, |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 } | 128 } |
128 } else { | 129 } else { |
129 // Group, recurse through children. | 130 // Group, recurse through children. |
130 for (int i = 0; i < node->GetChildCount(); ++i) { | 131 for (int i = 0; i < node->GetChildCount(); ++i) { |
131 OpenAllImpl(node->GetChild(i), initial_disposition, navigator, | 132 OpenAllImpl(node->GetChild(i), initial_disposition, navigator, |
132 opened_url); | 133 opened_url); |
133 } | 134 } |
134 } | 135 } |
135 } | 136 } |
136 | 137 |
137 bool ShouldOpenAll(gfx::NativeWindow parent, const std::vector<BookmarkNode*>& n
odes) { | 138 bool ShouldOpenAll(gfx::NativeWindow parent, |
| 139 const std::vector<BookmarkNode*>& nodes) { |
138 int descendant_count = 0; | 140 int descendant_count = 0; |
139 for (size_t i = 0; i < nodes.size(); ++i) | 141 for (size_t i = 0; i < nodes.size(); ++i) |
140 descendant_count += DescendantURLCount(nodes[i]); | 142 descendant_count += DescendantURLCount(nodes[i]); |
141 if (descendant_count < bookmark_utils::num_urls_before_prompting) | 143 if (descendant_count < bookmark_utils::num_urls_before_prompting) |
142 return true; | 144 return true; |
143 | 145 |
144 std::wstring message = | 146 std::wstring message = |
145 l10n_util::GetStringF(IDS_BOOKMARK_BAR_SHOULD_OPEN_ALL, | 147 l10n_util::GetStringF(IDS_BOOKMARK_BAR_SHOULD_OPEN_ALL, |
146 IntToWString(descendant_count)); | 148 IntToWString(descendant_count)); |
147 #if defined(OS_WIN) | 149 #if defined(OS_WIN) |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 std::vector<std::wstring> words; | 463 std::vector<std::wstring> words; |
462 QueryParser parser; | 464 QueryParser parser; |
463 parser.ExtractQueryWords(l10n_util::ToLower(text), &words); | 465 parser.ExtractQueryWords(l10n_util::ToLower(text), &words); |
464 if (words.empty()) | 466 if (words.empty()) |
465 return false; | 467 return false; |
466 | 468 |
467 return (node->is_url() && DoesBookmarkContainWords(node, words)); | 469 return (node->is_url() && DoesBookmarkContainWords(node, words)); |
468 } | 470 } |
469 | 471 |
470 } // namespace bookmark_utils | 472 } // namespace bookmark_utils |
OLD | NEW |