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

Side by Side Diff: chrome/browser/tabs/tab_strip_model.cc

Issue 122012: Reload All tabs feature... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 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/tabs/tab_strip_model.h ('k') | chrome/browser/views/tabs/tab.cc » ('j') | 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/tabs/tab_strip_model.h" 5 #include "chrome/browser/tabs/tab_strip_model.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/stl_util-inl.h" 9 #include "base/stl_util-inl.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 398
399 // Context menu functions. 399 // Context menu functions.
400 bool TabStripModel::IsContextMenuCommandEnabled( 400 bool TabStripModel::IsContextMenuCommandEnabled(
401 int context_index, ContextMenuCommand command_id) const { 401 int context_index, ContextMenuCommand command_id) const {
402 DCHECK(command_id > CommandFirst && command_id < CommandLast); 402 DCHECK(command_id > CommandFirst && command_id < CommandLast);
403 switch (command_id) { 403 switch (command_id) {
404 case CommandNewTab: 404 case CommandNewTab:
405 case CommandReload: 405 case CommandReload:
406 case CommandCloseTab: 406 case CommandCloseTab:
407 return true; 407 return true;
408 case CommandReloadAll:
408 case CommandCloseOtherTabs: 409 case CommandCloseOtherTabs:
409 return count() > 1; 410 return count() > 1;
410 case CommandCloseTabsToRight: 411 case CommandCloseTabsToRight:
411 return context_index < (count() - 1); 412 return context_index < (count() - 1);
412 case CommandCloseTabsOpenedBy: { 413 case CommandCloseTabsOpenedBy: {
413 int next_index = GetIndexOfNextTabContentsOpenedBy( 414 int next_index = GetIndexOfNextTabContentsOpenedBy(
414 &GetTabContentsAt(context_index)->controller(), context_index, true); 415 &GetTabContentsAt(context_index)->controller(), context_index, true);
415 return next_index != kNoTab; 416 return next_index != kNoTab;
416 } 417 }
417 case CommandDuplicate: 418 case CommandDuplicate:
(...skipping 11 matching lines...) Expand all
429 DCHECK(command_id > CommandFirst && command_id < CommandLast); 430 DCHECK(command_id > CommandFirst && command_id < CommandLast);
430 switch (command_id) { 431 switch (command_id) {
431 case CommandNewTab: 432 case CommandNewTab:
432 UserMetrics::RecordAction(L"TabContextMenu_NewTab", profile_); 433 UserMetrics::RecordAction(L"TabContextMenu_NewTab", profile_);
433 delegate()->AddBlankTabAt(context_index + 1, true); 434 delegate()->AddBlankTabAt(context_index + 1, true);
434 break; 435 break;
435 case CommandReload: 436 case CommandReload:
436 UserMetrics::RecordAction(L"TabContextMenu_Reload", profile_); 437 UserMetrics::RecordAction(L"TabContextMenu_Reload", profile_);
437 GetContentsAt(context_index)->controller().Reload(true); 438 GetContentsAt(context_index)->controller().Reload(true);
438 break; 439 break;
440 case CommandReloadAll: {
441 UserMetrics::RecordAction(L"TabContextMenu_ReloadAll", profile_);
442 for (int i = count() - 1; i >= 0; --i)
443 GetContentsAt(i)->controller().Reload(true);
444 break;
445 }
439 case CommandDuplicate: 446 case CommandDuplicate:
440 UserMetrics::RecordAction(L"TabContextMenu_Duplicate", profile_); 447 UserMetrics::RecordAction(L"TabContextMenu_Duplicate", profile_);
441 delegate_->DuplicateContentsAt(context_index); 448 delegate_->DuplicateContentsAt(context_index);
442 break; 449 break;
443 case CommandCloseTab: 450 case CommandCloseTab:
444 UserMetrics::RecordAction(L"TabContextMenu_CloseTab", profile_); 451 UserMetrics::RecordAction(L"TabContextMenu_CloseTab", profile_);
445 CloseTabContentsAt(context_index); 452 CloseTabContentsAt(context_index);
446 break; 453 break;
447 case CommandCloseOtherTabs: { 454 case CommandCloseOtherTabs: {
448 UserMetrics::RecordAction(L"TabContextMenu_CloseOtherTabs", profile_); 455 UserMetrics::RecordAction(L"TabContextMenu_CloseOtherTabs", profile_);
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 int index = GetIndexOfTabContents(contents); 586 int index = GetIndexOfTabContents(contents);
580 contents_data_.at(index)->opener = &opener->controller(); 587 contents_data_.at(index)->opener = &opener->controller();
581 } 588 }
582 589
583 // static 590 // static
584 bool TabStripModel::OpenerMatches(const TabContentsData* data, 591 bool TabStripModel::OpenerMatches(const TabContentsData* data,
585 const NavigationController* opener, 592 const NavigationController* opener,
586 bool use_group) { 593 bool use_group) {
587 return data->opener == opener || (use_group && data->group == opener); 594 return data->opener == opener || (use_group && data->group == opener);
588 } 595 }
OLDNEW
« no previous file with comments | « chrome/browser/tabs/tab_strip_model.h ('k') | chrome/browser/views/tabs/tab.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698