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

Unified Diff: chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.cc

Issue 12605010: Add new option to open history page to show more other devices (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: DCHECK_GT Created 7 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.cc
diff --git a/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.cc b/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.cc
index d8d5204575afe9a1a9644f67fa4f559b63d30c57..b7d2df0d2dd72815ddea92db5c968c247906a3ff 100644
--- a/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.cc
+++ b/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.cc
@@ -150,6 +150,9 @@ bool RecentTabsSubMenuModel::IsCommandIdEnabled(int command_id) const {
command_id == IDC_RECENT_TABS_NO_DEVICE_TABS) {
return false;
}
+ if (command_id == IDC_SHOW_HISTORY) {
+ return true;
+ }
int model_index = CommandIdToModelIndex(command_id);
return model_index >= 0 && model_index < static_cast<int>(model_.size());
}
@@ -189,6 +192,12 @@ void RecentTabsSubMenuModel::ExecuteCommand(int command_id, int event_flags) {
ui::DispositionFromEventFlags(event_flags));
return;
}
+ if (command_id == IDC_SHOW_HISTORY) {
+ // We show all "other devices" on the history page.
+ chrome::ExecuteCommandWithDisposition(browser_, IDC_SHOW_HISTORY,
+ ui::DispositionFromEventFlags(event_flags));
+ return;
+ }
DCHECK_NE(kDisabledCommandId, command_id);
DCHECK_NE(IDC_RECENT_TABS_NO_DEVICE_TABS, command_id);
@@ -270,8 +279,7 @@ void RecentTabsSubMenuModel::BuildDevices() {
const size_t kMaxSessionsToShow = 3;
size_t num_sessions_added = 0;
for (size_t i = 0;
- i < sessions.size() && num_sessions_added < kMaxSessionsToShow;
- ++i) {
+ i < sessions.size() && num_sessions_added < kMaxSessionsToShow; ++i) {
const browser_sync::SyncedSession* session = sessions[i];
const std::string& session_tag = session->session_tag;
@@ -322,6 +330,11 @@ void RecentTabsSubMenuModel::BuildDevices() {
++num_sessions_added;
} // for all sessions
+
+ // We are not supposed to get here unless at least some items were added.
+ DCHECK_GT(GetItemCount(), 0);
+ AddSeparator(ui::NORMAL_SEPARATOR);
+ AddItemWithStringId(IDC_SHOW_HISTORY, IDS_RECENT_TABS_MORE);
}
void RecentTabsSubMenuModel::BuildForeignTabItem(

Powered by Google App Engine
This is Rietveld 408576698