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

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

Issue 10536059: TabContentsWrapper -> TabContents, part 7. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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_manager_extension_api.cc ('k') | no next file » | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 disposition = initial_disposition; 150 disposition = initial_disposition;
151 (*navigator)->OpenURL(OpenURLParams(node->url(), content::Referrer(), 151 (*navigator)->OpenURL(OpenURLParams(node->url(), content::Referrer(),
152 disposition, content::PAGE_TRANSITION_AUTO_BOOKMARK, 152 disposition, content::PAGE_TRANSITION_AUTO_BOOKMARK,
153 false)); 153 false));
154 if (!*opened_url) { 154 if (!*opened_url) {
155 *opened_url = true; 155 *opened_url = true;
156 // We opened the first URL which may have opened a new window or clobbered 156 // We opened the first URL which may have opened a new window or clobbered
157 // the current page, reset the navigator just to be sure. 157 // the current page, reset the navigator just to be sure.
158 Browser* new_browser = browser::FindLastActiveWithProfile(profile); 158 Browser* new_browser = browser::FindLastActiveWithProfile(profile);
159 if (new_browser) { 159 if (new_browser) {
160 WebContents* current_tab = new_browser->GetSelectedWebContents(); 160 WebContents* current_tab = new_browser->GetActiveWebContents();
161 if (current_tab) 161 if (current_tab)
162 *navigator = current_tab; 162 *navigator = current_tab;
163 } // else, new_browser == NULL, which happens during testing. 163 } // else, new_browser == NULL, which happens during testing.
164 } 164 }
165 } else { 165 } else {
166 // For folders only open direct children. 166 // For folders only open direct children.
167 for (int i = 0; i < node->child_count(); ++i) { 167 for (int i = 0; i < node->child_count(); ++i) {
168 const BookmarkNode* child_node = node->GetChild(i); 168 const BookmarkNode* child_node = node->GetChild(i);
169 if (child_node->is_url()) 169 if (child_node->is_url())
170 OpenAllImpl(child_node, initial_disposition, navigator, profile, 170 OpenAllImpl(child_node, initial_disposition, navigator, profile,
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 Profile* profile, 382 Profile* profile,
383 PageNavigator* navigator, 383 PageNavigator* navigator,
384 const std::vector<const BookmarkNode*>& nodes, 384 const std::vector<const BookmarkNode*>& nodes,
385 WindowOpenDisposition initial_disposition) { 385 WindowOpenDisposition initial_disposition) {
386 if (!ShouldOpenAll(parent, nodes)) 386 if (!ShouldOpenAll(parent, nodes))
387 return; 387 return;
388 388
389 NewBrowserPageNavigator navigator_impl(profile); 389 NewBrowserPageNavigator navigator_impl(profile);
390 if (!navigator) { 390 if (!navigator) {
391 Browser* browser = browser::FindTabbedBrowser(profile, false); 391 Browser* browser = browser::FindTabbedBrowser(profile, false);
392 if (!browser || !browser->GetSelectedWebContents()) { 392 if (!browser || !browser->GetActiveWebContents()) {
393 navigator = &navigator_impl; 393 navigator = &navigator_impl;
394 } else { 394 } else {
395 if (initial_disposition != NEW_WINDOW && 395 if (initial_disposition != NEW_WINDOW &&
396 initial_disposition != OFF_THE_RECORD) { 396 initial_disposition != OFF_THE_RECORD) {
397 browser->window()->Activate(); 397 browser->window()->Activate();
398 } 398 }
399 navigator = browser->GetSelectedWebContents(); 399 navigator = browser->GetActiveWebContents();
400 } 400 }
401 } 401 }
402 402
403 bool opened_url = false; 403 bool opened_url = false;
404 if (initial_disposition == OFF_THE_RECORD) 404 if (initial_disposition == OFF_THE_RECORD)
405 profile = profile->GetOffTheRecordProfile(); 405 profile = profile->GetOffTheRecordProfile();
406 406
407 for (size_t i = 0; i < nodes.size(); ++i) 407 for (size_t i = 0; i < nodes.size(); ++i)
408 OpenAllImpl(nodes[i], initial_disposition, &navigator, profile, 408 OpenAllImpl(nodes[i], initial_disposition, &navigator, profile,
409 &opened_url); 409 &opened_url);
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 GURL* url, 660 GURL* url,
661 string16* title) { 661 string16* title) {
662 *url = web_contents->GetURL(); 662 *url = web_contents->GetURL();
663 *title = web_contents->GetTitle(); 663 *title = web_contents->GetTitle();
664 } 664 }
665 665
666 void GetURLAndTitleToBookmarkFromCurrentTab(Profile* profile, 666 void GetURLAndTitleToBookmarkFromCurrentTab(Profile* profile,
667 GURL* url, 667 GURL* url,
668 string16* title) { 668 string16* title) {
669 Browser* browser = browser::FindLastActiveWithProfile(profile); 669 Browser* browser = browser::FindLastActiveWithProfile(profile);
670 WebContents* web_contents = browser ? browser->GetSelectedWebContents() 670 WebContents* web_contents = browser ? browser->GetActiveWebContents()
671 : NULL; 671 : NULL;
672 if (web_contents) 672 if (web_contents)
673 GetURLAndTitleToBookmark(web_contents, url, title); 673 GetURLAndTitleToBookmark(web_contents, url, title);
674 } 674 }
675 675
676 void GetURLsForOpenTabs( 676 void GetURLsForOpenTabs(
677 Browser* browser, 677 Browser* browser,
678 std::vector<std::pair<GURL, string16> >* urls) { 678 std::vector<std::pair<GURL, string16> >* urls) {
679 for (int i = 0; i < browser->tab_count(); ++i) { 679 for (int i = 0; i < browser->tab_count(); ++i) {
680 std::pair<GURL, string16> entry; 680 std::pair<GURL, string16> entry;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 void RecordBookmarkLaunch(BookmarkLaunchLocation location) { 775 void RecordBookmarkLaunch(BookmarkLaunchLocation location) {
776 #if defined(OS_WIN) 776 #if defined(OS_WIN)
777 // TODO(estade): do this on other platforms too. For now it's compiled out 777 // TODO(estade): do this on other platforms too. For now it's compiled out
778 // so that stats from platforms for which this is incompletely implemented 778 // so that stats from platforms for which this is incompletely implemented
779 // don't mix in with Windows, where it should be implemented exhaustively. 779 // don't mix in with Windows, where it should be implemented exhaustively.
780 UMA_HISTOGRAM_ENUMERATION("Bookmarks.LaunchLocation", location, LAUNCH_LIMIT); 780 UMA_HISTOGRAM_ENUMERATION("Bookmarks.LaunchLocation", location, LAUNCH_LIMIT);
781 #endif 781 #endif
782 } 782 }
783 783
784 } // namespace bookmark_utils 784 } // namespace bookmark_utils
OLDNEW
« no previous file with comments | « chrome/browser/bookmarks/bookmark_manager_extension_api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698