OLD | NEW |
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 "build/build_config.h" | 5 #include "build/build_config.h" |
6 | 6 |
7 #include "chrome/browser/ui/toolbar/back_forward_menu_model.h" | 7 #include "chrome/browser/ui/toolbar/back_forward_menu_model.h" |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 } | 363 } |
364 } | 364 } |
365 | 365 |
366 NavigationEntry* start_entry = controller.GetEntryAtIndex(start_from); | 366 NavigationEntry* start_entry = controller.GetEntryAtIndex(start_from); |
367 const GURL& url = start_entry->GetURL(); | 367 const GURL& url = start_entry->GetURL(); |
368 | 368 |
369 if (!forward) { | 369 if (!forward) { |
370 // When going backwards we return the first entry we find that has a | 370 // When going backwards we return the first entry we find that has a |
371 // different domain. | 371 // different domain. |
372 for (int i = start_from - 1; i >= 0; --i) { | 372 for (int i = start_from - 1; i >= 0; --i) { |
373 if (!net::RegistryControlledDomainService::SameDomainOrHost(url, | 373 if (!net::registry_controlled_domains::SameDomainOrHost(url, |
374 controller.GetEntryAtIndex(i)->GetURL())) | 374 controller.GetEntryAtIndex(i)->GetURL(), |
| 375 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES)) |
375 return i; | 376 return i; |
376 } | 377 } |
377 // We have reached the beginning without finding a chapter stop. | 378 // We have reached the beginning without finding a chapter stop. |
378 return -1; | 379 return -1; |
379 } else { | 380 } else { |
380 // When going forwards we return the entry before the entry that has a | 381 // When going forwards we return the entry before the entry that has a |
381 // different domain. | 382 // different domain. |
382 for (int i = start_from + 1; i < max_count; ++i) { | 383 for (int i = start_from + 1; i < max_count; ++i) { |
383 if (!net::RegistryControlledDomainService::SameDomainOrHost(url, | 384 if (!net::registry_controlled_domains::SameDomainOrHost(url, |
384 controller.GetEntryAtIndex(i)->GetURL())) | 385 controller.GetEntryAtIndex(i)->GetURL(), |
| 386 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES)) |
385 return i - 1; | 387 return i - 1; |
386 } | 388 } |
387 // Last entry is always considered a chapter stop. | 389 // Last entry is always considered a chapter stop. |
388 return max_count - 1; | 390 return max_count - 1; |
389 } | 391 } |
390 } | 392 } |
391 | 393 |
392 int BackForwardMenuModel::FindChapterStop(int offset, | 394 int BackForwardMenuModel::FindChapterStop(int offset, |
393 bool forward, | 395 bool forward, |
394 int skip) const { | 396 int skip) const { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 metric_string += "ForwardMenu_"; | 476 metric_string += "ForwardMenu_"; |
475 else | 477 else |
476 metric_string += "BackMenu_"; | 478 metric_string += "BackMenu_"; |
477 metric_string += action; | 479 metric_string += action; |
478 if (index != -1) { | 480 if (index != -1) { |
479 // +1 is for historical reasons (indices used to start at 1). | 481 // +1 is for historical reasons (indices used to start at 1). |
480 metric_string += base::IntToString(index + 1); | 482 metric_string += base::IntToString(index + 1); |
481 } | 483 } |
482 return metric_string; | 484 return metric_string; |
483 } | 485 } |
OLD | NEW |