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

Side by Side Diff: chrome/browser/ui/webui/ntp/foreign_session_handler.cc

Issue 14497003: Moves TabNavigation into components/sessions and renames (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Really remove webkit_support Created 7 years, 7 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
OLDNEW
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 "chrome/browser/ui/webui/ntp/foreign_session_handler.h" 5 #include "chrome/browser/ui/webui/ntp/foreign_session_handler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 120
121 // static 121 // static
122 bool ForeignSessionHandler::SessionTabToValue( 122 bool ForeignSessionHandler::SessionTabToValue(
123 const SessionTab& tab, 123 const SessionTab& tab,
124 DictionaryValue* dictionary) { 124 DictionaryValue* dictionary) {
125 if (tab.navigations.empty()) 125 if (tab.navigations.empty())
126 return false; 126 return false;
127 127
128 int selected_index = std::min(tab.current_navigation_index, 128 int selected_index = std::min(tab.current_navigation_index,
129 static_cast<int>(tab.navigations.size() - 1)); 129 static_cast<int>(tab.navigations.size() - 1));
130 const TabNavigation& current_navigation = 130 const ::sessions::SerializedNavigationEntry& current_navigation =
131 tab.navigations.at(selected_index); 131 tab.navigations.at(selected_index);
132 GURL tab_url = current_navigation.virtual_url(); 132 GURL tab_url = current_navigation.virtual_url();
133 if (tab_url == GURL(chrome::kChromeUINewTabURL)) 133 if (tab_url == GURL(chrome::kChromeUINewTabURL))
134 return false; 134 return false;
135 135
136 NewTabUI::SetUrlTitleAndDirection(dictionary, current_navigation.title(), 136 NewTabUI::SetUrlTitleAndDirection(dictionary, current_navigation.title(),
137 tab_url); 137 tab_url);
138 dictionary->SetString("type", "tab"); 138 dictionary->SetString("type", "tab");
139 dictionary->SetDouble("timestamp", 139 dictionary->SetDouble("timestamp",
140 static_cast<double>(tab.timestamp.ToInternalValue())); 140 static_cast<double>(tab.timestamp.ToInternalValue()));
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 dictionary->SetString("userVisibleTimestamp", 403 dictionary->SetString("userVisibleTimestamp",
404 last_synced < base::TimeDelta::FromMinutes(1) ? 404 last_synced < base::TimeDelta::FromMinutes(1) ?
405 l10n_util::GetStringUTF16(IDS_SYNC_TIME_JUST_NOW) : 405 l10n_util::GetStringUTF16(IDS_SYNC_TIME_JUST_NOW) :
406 TimeFormat::TimeElapsed(last_synced)); 406 TimeFormat::TimeElapsed(last_synced));
407 dictionary->SetInteger("sessionId", window.window_id.id()); 407 dictionary->SetInteger("sessionId", window.window_id.id());
408 dictionary->Set("tabs", tab_values.release()); 408 dictionary->Set("tabs", tab_values.release());
409 return true; 409 return true;
410 } 410 }
411 411
412 } // namespace browser_sync 412 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698