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" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 } | 70 } |
71 | 71 |
72 Browser* browser() const { return browser_; } | 72 Browser* browser() const { return browser_; } |
73 | 73 |
74 // Deprecated. Please use one-argument variant. | 74 // Deprecated. Please use one-argument variant. |
75 // TODO(adriansc): Remove this method once refactoring changed all call sites. | 75 // TODO(adriansc): Remove this method once refactoring changed all call sites. |
76 virtual TabContents* OpenURL(const GURL& url, | 76 virtual TabContents* OpenURL(const GURL& url, |
77 const GURL& referrer, | 77 const GURL& referrer, |
78 WindowOpenDisposition disposition, | 78 WindowOpenDisposition disposition, |
79 content::PageTransition transition) OVERRIDE { | 79 content::PageTransition transition) OVERRIDE { |
80 return OpenURL(OpenURLParams(url, referrer, disposition, transition, | 80 DCHECK(referrer.is_empty()); |
81 false)); | 81 return OpenURL(OpenURLParams(url, content::Referrer(), disposition, |
| 82 transition, false)); |
82 } | 83 } |
83 | 84 |
84 virtual TabContents* OpenURL(const OpenURLParams& params) OVERRIDE { | 85 virtual TabContents* OpenURL(const OpenURLParams& params) OVERRIDE { |
85 if (!browser_) { | 86 if (!browser_) { |
86 Profile* profile = (params.disposition == OFF_THE_RECORD) ? | 87 Profile* profile = (params.disposition == OFF_THE_RECORD) ? |
87 profile_->GetOffTheRecordProfile() : profile_; | 88 profile_->GetOffTheRecordProfile() : profile_; |
88 browser_ = Browser::Create(profile); | 89 browser_ = Browser::Create(profile); |
89 } | 90 } |
90 | 91 |
91 OpenURLParams forward_params = params; | 92 OpenURLParams forward_params = params; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 WindowOpenDisposition initial_disposition, | 149 WindowOpenDisposition initial_disposition, |
149 PageNavigator** navigator, | 150 PageNavigator** navigator, |
150 Profile* profile, | 151 Profile* profile, |
151 bool* opened_url) { | 152 bool* opened_url) { |
152 if (node->is_url()) { | 153 if (node->is_url()) { |
153 WindowOpenDisposition disposition; | 154 WindowOpenDisposition disposition; |
154 if (*opened_url) | 155 if (*opened_url) |
155 disposition = NEW_BACKGROUND_TAB; | 156 disposition = NEW_BACKGROUND_TAB; |
156 else | 157 else |
157 disposition = initial_disposition; | 158 disposition = initial_disposition; |
158 (*navigator)->OpenURL(OpenURLParams(node->url(), GURL(), disposition, | 159 (*navigator)->OpenURL(OpenURLParams(node->url(), content::Referrer(), |
159 content::PAGE_TRANSITION_AUTO_BOOKMARK, false)); | 160 disposition, content::PAGE_TRANSITION_AUTO_BOOKMARK, |
| 161 false)); |
160 if (!*opened_url) { | 162 if (!*opened_url) { |
161 *opened_url = true; | 163 *opened_url = true; |
162 // We opened the first URL which may have opened a new window or clobbered | 164 // We opened the first URL which may have opened a new window or clobbered |
163 // the current page, reset the navigator just to be sure. | 165 // the current page, reset the navigator just to be sure. |
164 Browser* new_browser = BrowserList::GetLastActiveWithProfile(profile); | 166 Browser* new_browser = BrowserList::GetLastActiveWithProfile(profile); |
165 if (new_browser) { | 167 if (new_browser) { |
166 TabContents* current_tab = new_browser->GetSelectedTabContents(); | 168 TabContents* current_tab = new_browser->GetSelectedTabContents(); |
167 DCHECK(new_browser && current_tab); | 169 DCHECK(new_browser && current_tab); |
168 if (new_browser && current_tab) | 170 if (new_browser && current_tab) |
169 *navigator = current_tab; | 171 *navigator = current_tab; |
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
770 void RecordBookmarkLaunch(BookmarkLaunchLocation location) { | 772 void RecordBookmarkLaunch(BookmarkLaunchLocation location) { |
771 #if defined(OS_WIN) | 773 #if defined(OS_WIN) |
772 // TODO(estade): do this on other platforms too. For now it's compiled out | 774 // TODO(estade): do this on other platforms too. For now it's compiled out |
773 // so that stats from platforms for which this is incompletely implemented | 775 // so that stats from platforms for which this is incompletely implemented |
774 // don't mix in with Windows, where it should be implemented exhaustively. | 776 // don't mix in with Windows, where it should be implemented exhaustively. |
775 UMA_HISTOGRAM_ENUMERATION("Bookmarks.LaunchLocation", location, LAUNCH_LIMIT); | 777 UMA_HISTOGRAM_ENUMERATION("Bookmarks.LaunchLocation", location, LAUNCH_LIMIT); |
776 #endif | 778 #endif |
777 } | 779 } |
778 | 780 |
779 } // namespace bookmark_utils | 781 } // namespace bookmark_utils |
OLD | NEW |