| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/ui/bookmarks/bookmark_utils_desktop.h" | 5 #include "chrome/browser/ui/bookmarks/bookmark_utils_desktop.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 // disposition of new window, in which case we want subsequent tabs to open in | 189 // disposition of new window, in which case we want subsequent tabs to open in |
| 190 // that window. | 190 // that window. |
| 191 bool opened_first_url = false; | 191 bool opened_first_url = false; |
| 192 WindowOpenDisposition disposition = initial_disposition; | 192 WindowOpenDisposition disposition = initial_disposition; |
| 193 OpenURLIterator iterator(nodes); | 193 OpenURLIterator iterator(nodes); |
| 194 while (iterator.has_next()) { | 194 while (iterator.has_next()) { |
| 195 const GURL* url = iterator.NextURL(); | 195 const GURL* url = iterator.NextURL(); |
| 196 // When |initial_disposition| is OFF_THE_RECORD, a node which can't be | 196 // When |initial_disposition| is OFF_THE_RECORD, a node which can't be |
| 197 // opened in incognito window, it is detected using |browser_context|, is | 197 // opened in incognito window, it is detected using |browser_context|, is |
| 198 // not opened. | 198 // not opened. |
| 199 if (initial_disposition == OFF_THE_RECORD && | 199 if (initial_disposition == WindowOpenDisposition::OFF_THE_RECORD && |
| 200 !IsURLAllowedInIncognito(*url, browser_context)) | 200 !IsURLAllowedInIncognito(*url, browser_context)) |
| 201 continue; | 201 continue; |
| 202 | 202 |
| 203 content::WebContents* opened_tab = navigator->OpenURL( | 203 content::WebContents* opened_tab = navigator->OpenURL( |
| 204 content::OpenURLParams(*url, content::Referrer(), disposition, | 204 content::OpenURLParams(*url, content::Referrer(), disposition, |
| 205 ui::PAGE_TRANSITION_AUTO_BOOKMARK, false)); | 205 ui::PAGE_TRANSITION_AUTO_BOOKMARK, false)); |
| 206 | 206 |
| 207 if (!opened_first_url) { | 207 if (!opened_first_url) { |
| 208 opened_first_url = true; | 208 opened_first_url = true; |
| 209 disposition = NEW_BACKGROUND_TAB; | 209 disposition = WindowOpenDisposition::NEW_BACKGROUND_TAB; |
| 210 // We opened the first URL which may have opened a new window or clobbered | 210 // We opened the first URL which may have opened a new window or clobbered |
| 211 // the current page, reset the navigator just to be sure. |opened_tab| may | 211 // the current page, reset the navigator just to be sure. |opened_tab| may |
| 212 // be NULL in tests. | 212 // be NULL in tests. |
| 213 if (opened_tab) | 213 if (opened_tab) |
| 214 navigator = opened_tab; | 214 navigator = opened_tab; |
| 215 } | 215 } |
| 216 } | 216 } |
| 217 } | 217 } |
| 218 | 218 |
| 219 void OpenAll(gfx::NativeWindow parent, | 219 void OpenAll(gfx::NativeWindow parent, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 while (iterator.has_next()) { | 264 while (iterator.has_next()) { |
| 265 const GURL* url = iterator.NextURL(); | 265 const GURL* url = iterator.NextURL(); |
| 266 if (IsURLAllowedInIncognito(*url, browser_context)) | 266 if (IsURLAllowedInIncognito(*url, browser_context)) |
| 267 return true; | 267 return true; |
| 268 } | 268 } |
| 269 return false; | 269 return false; |
| 270 } | 270 } |
| 271 #endif // !defined(OS_ANDROID) | 271 #endif // !defined(OS_ANDROID) |
| 272 | 272 |
| 273 } // namespace chrome | 273 } // namespace chrome |
| OLD | NEW |