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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 } | 69 } |
70 | 70 |
71 Browser* browser() const { return browser_; } | 71 Browser* browser() const { return browser_; } |
72 | 72 |
73 // Deprecated. Please use one-argument variant. | 73 // Deprecated. Please use one-argument variant. |
74 // TODO(adriansc): Remove this method once refactoring changed all call sites. | 74 // TODO(adriansc): Remove this method once refactoring changed all call sites. |
75 virtual TabContents* OpenURL(const GURL& url, | 75 virtual TabContents* OpenURL(const GURL& url, |
76 const GURL& referrer, | 76 const GURL& referrer, |
77 WindowOpenDisposition disposition, | 77 WindowOpenDisposition disposition, |
78 content::PageTransition transition) OVERRIDE { | 78 content::PageTransition transition) OVERRIDE { |
79 return OpenURL(OpenURLParams(url, referrer, disposition, transition)); | 79 return OpenURL(OpenURLParams(url, referrer, disposition, transition, |
| 80 false)); |
80 } | 81 } |
81 | 82 |
82 virtual TabContents* OpenURL(const OpenURLParams& params) OVERRIDE { | 83 virtual TabContents* OpenURL(const OpenURLParams& params) OVERRIDE { |
83 if (!browser_) { | 84 if (!browser_) { |
84 Profile* profile = (params.disposition == OFF_THE_RECORD) ? | 85 Profile* profile = (params.disposition == OFF_THE_RECORD) ? |
85 profile_->GetOffTheRecordProfile() : profile_; | 86 profile_->GetOffTheRecordProfile() : profile_; |
86 browser_ = Browser::Create(profile); | 87 browser_ = Browser::Create(profile); |
87 } | 88 } |
88 | 89 |
89 OpenURLParams forward_params = params; | 90 OpenURLParams forward_params = params; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 PageNavigator** navigator, | 148 PageNavigator** navigator, |
148 Profile* profile, | 149 Profile* profile, |
149 bool* opened_url) { | 150 bool* opened_url) { |
150 if (node->is_url()) { | 151 if (node->is_url()) { |
151 WindowOpenDisposition disposition; | 152 WindowOpenDisposition disposition; |
152 if (*opened_url) | 153 if (*opened_url) |
153 disposition = NEW_BACKGROUND_TAB; | 154 disposition = NEW_BACKGROUND_TAB; |
154 else | 155 else |
155 disposition = initial_disposition; | 156 disposition = initial_disposition; |
156 (*navigator)->OpenURL(OpenURLParams(node->url(), GURL(), disposition, | 157 (*navigator)->OpenURL(OpenURLParams(node->url(), GURL(), disposition, |
157 content::PAGE_TRANSITION_AUTO_BOOKMARK)); | 158 content::PAGE_TRANSITION_AUTO_BOOKMARK, false)); |
158 if (!*opened_url) { | 159 if (!*opened_url) { |
159 *opened_url = true; | 160 *opened_url = true; |
160 // We opened the first URL which may have opened a new window or clobbered | 161 // We opened the first URL which may have opened a new window or clobbered |
161 // the current page, reset the navigator just to be sure. | 162 // the current page, reset the navigator just to be sure. |
162 Browser* new_browser = BrowserList::GetLastActiveWithProfile(profile); | 163 Browser* new_browser = BrowserList::GetLastActiveWithProfile(profile); |
163 if (new_browser) { | 164 if (new_browser) { |
164 TabContents* current_tab = new_browser->GetSelectedTabContents(); | 165 TabContents* current_tab = new_browser->GetSelectedTabContents(); |
165 DCHECK(new_browser && current_tab); | 166 DCHECK(new_browser && current_tab); |
166 if (new_browser && current_tab) | 167 if (new_browser && current_tab) |
167 *navigator = current_tab; | 168 *navigator = current_tab; |
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
761 // Remove all the bookmarks. | 762 // Remove all the bookmarks. |
762 for (size_t i = 0; i < bookmarks.size(); ++i) { | 763 for (size_t i = 0; i < bookmarks.size(); ++i) { |
763 const BookmarkNode* node = bookmarks[i]; | 764 const BookmarkNode* node = bookmarks[i]; |
764 int index = node->parent()->GetIndexOf(node); | 765 int index = node->parent()->GetIndexOf(node); |
765 if (index > -1) | 766 if (index > -1) |
766 model->Remove(node->parent(), index); | 767 model->Remove(node->parent(), index); |
767 } | 768 } |
768 } | 769 } |
769 | 770 |
770 } // namespace bookmark_utils | 771 } // namespace bookmark_utils |
OLD | NEW |