Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Side by Side Diff: chrome/browser/bookmarks/bookmark_utils.cc

Issue 115831: Converts a bunch things from NativeWindow to NativeView to make it... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/bookmarks/bookmark_utils.h ('k') | chrome/browser/gtk/bookmark_bar_gtk.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 } 131 }
132 } else { 132 } else {
133 // Group, recurse through children. 133 // Group, recurse through children.
134 for (int i = 0; i < node->GetChildCount(); ++i) { 134 for (int i = 0; i < node->GetChildCount(); ++i) {
135 OpenAllImpl(node->GetChild(i), initial_disposition, navigator, 135 OpenAllImpl(node->GetChild(i), initial_disposition, navigator,
136 opened_url); 136 opened_url);
137 } 137 }
138 } 138 }
139 } 139 }
140 140
141 bool ShouldOpenAll(gfx::NativeWindow parent, 141 bool ShouldOpenAll(gfx::NativeView parent,
142 const std::vector<BookmarkNode*>& nodes) { 142 const std::vector<BookmarkNode*>& nodes) {
143 int descendant_count = 0; 143 int descendant_count = 0;
144 for (size_t i = 0; i < nodes.size(); ++i) 144 for (size_t i = 0; i < nodes.size(); ++i)
145 descendant_count += DescendantURLCount(nodes[i]); 145 descendant_count += DescendantURLCount(nodes[i]);
146 if (descendant_count < bookmark_utils::num_urls_before_prompting) 146 if (descendant_count < bookmark_utils::num_urls_before_prompting)
147 return true; 147 return true;
148 148
149 std::wstring message = 149 std::wstring message =
150 l10n_util::GetStringF(IDS_BOOKMARK_BAR_SHOULD_OPEN_ALL, 150 l10n_util::GetStringF(IDS_BOOKMARK_BAR_SHOULD_OPEN_ALL,
151 IntToWString(descendant_count)); 151 IntToWString(descendant_count));
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 BookmarkNode* parent, 299 BookmarkNode* parent,
300 int index_to_add_at) { 300 int index_to_add_at) {
301 if (!parent->is_folder() || !model) { 301 if (!parent->is_folder() || !model) {
302 NOTREACHED(); 302 NOTREACHED();
303 return; 303 return;
304 } 304 }
305 for (size_t i = 0; i < elements.size(); ++i) 305 for (size_t i = 0; i < elements.size(); ++i)
306 CloneDragDataImpl(model, elements[i], parent, index_to_add_at + i); 306 CloneDragDataImpl(model, elements[i], parent, index_to_add_at + i);
307 } 307 }
308 308
309 void OpenAll(gfx::NativeWindow parent, 309 void OpenAll(gfx::NativeView parent,
310 Profile* profile, 310 Profile* profile,
311 PageNavigator* navigator, 311 PageNavigator* navigator,
312 const std::vector<BookmarkNode*>& nodes, 312 const std::vector<BookmarkNode*>& nodes,
313 WindowOpenDisposition initial_disposition) { 313 WindowOpenDisposition initial_disposition) {
314 if (!ShouldOpenAll(parent, nodes)) 314 if (!ShouldOpenAll(parent, nodes))
315 return; 315 return;
316 316
317 NewBrowserPageNavigator navigator_impl(profile); 317 NewBrowserPageNavigator navigator_impl(profile);
318 if (!navigator) { 318 if (!navigator) {
319 Browser* browser = 319 Browser* browser =
320 BrowserList::FindBrowserWithType(profile, Browser::TYPE_NORMAL); 320 BrowserList::FindBrowserWithType(profile, Browser::TYPE_NORMAL);
321 if (!browser || !browser->GetSelectedTabContents()) { 321 if (!browser || !browser->GetSelectedTabContents()) {
322 navigator = &navigator_impl; 322 navigator = &navigator_impl;
323 } else { 323 } else {
324 if (initial_disposition != NEW_WINDOW && 324 if (initial_disposition != NEW_WINDOW &&
325 initial_disposition != OFF_THE_RECORD) { 325 initial_disposition != OFF_THE_RECORD) {
326 browser->window()->Activate(); 326 browser->window()->Activate();
327 } 327 }
328 navigator = browser->GetSelectedTabContents(); 328 navigator = browser->GetSelectedTabContents();
329 } 329 }
330 } 330 }
331 331
332 bool opened_url = false; 332 bool opened_url = false;
333 for (size_t i = 0; i < nodes.size(); ++i) 333 for (size_t i = 0; i < nodes.size(); ++i)
334 OpenAllImpl(nodes[i], initial_disposition, &navigator, &opened_url); 334 OpenAllImpl(nodes[i], initial_disposition, &navigator, &opened_url);
335 } 335 }
336 336
337 void OpenAll(gfx::NativeWindow parent, 337 void OpenAll(gfx::NativeView parent,
338 Profile* profile, 338 Profile* profile,
339 PageNavigator* navigator, 339 PageNavigator* navigator,
340 BookmarkNode* node, 340 BookmarkNode* node,
341 WindowOpenDisposition initial_disposition) { 341 WindowOpenDisposition initial_disposition) {
342 std::vector<BookmarkNode*> nodes; 342 std::vector<BookmarkNode*> nodes;
343 nodes.push_back(node); 343 nodes.push_back(node);
344 OpenAll(parent, profile, navigator, nodes, initial_disposition); 344 OpenAll(parent, profile, navigator, nodes, initial_disposition);
345 } 345 }
346 346
347 void CopyToClipboard(BookmarkModel* model, 347 void CopyToClipboard(BookmarkModel* model,
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 605
606 // Formerly in BookmarkTableView 606 // Formerly in BookmarkTableView
607 prefs->RegisterIntegerPref(prefs::kBookmarkTableNameWidth1, -1); 607 prefs->RegisterIntegerPref(prefs::kBookmarkTableNameWidth1, -1);
608 prefs->RegisterIntegerPref(prefs::kBookmarkTableURLWidth1, -1); 608 prefs->RegisterIntegerPref(prefs::kBookmarkTableURLWidth1, -1);
609 prefs->RegisterIntegerPref(prefs::kBookmarkTableNameWidth2, -1); 609 prefs->RegisterIntegerPref(prefs::kBookmarkTableNameWidth2, -1);
610 prefs->RegisterIntegerPref(prefs::kBookmarkTableURLWidth2, -1); 610 prefs->RegisterIntegerPref(prefs::kBookmarkTableURLWidth2, -1);
611 prefs->RegisterIntegerPref(prefs::kBookmarkTablePathWidth, -1); 611 prefs->RegisterIntegerPref(prefs::kBookmarkTablePathWidth, -1);
612 } 612 }
613 613
614 } // namespace bookmark_utils 614 } // namespace bookmark_utils
OLDNEW
« no previous file with comments | « chrome/browser/bookmarks/bookmark_utils.h ('k') | chrome/browser/gtk/bookmark_bar_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698