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

Side by Side Diff: chrome/browser/sessions/base_session_service.cc

Issue 9359022: Aura: Support hovering restore & close buttons for full screen apps (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix browser_test Created 8 years, 10 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/sessions/base_session_service.h" 5 #include "chrome/browser/sessions/base_session_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/pickle.h" 10 #include "base/pickle.h"
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 static const SessionCommand::size_type max_id_size = 240 static const SessionCommand::size_type max_id_size =
241 std::numeric_limits<SessionCommand::size_type>::max() - 1024; 241 std::numeric_limits<SessionCommand::size_type>::max() - 1024;
242 242
243 int bytes_written = 0; 243 int bytes_written = 0;
244 244
245 WriteStringToPickle(pickle, &bytes_written, max_id_size, extension_id); 245 WriteStringToPickle(pickle, &bytes_written, max_id_size, extension_id);
246 246
247 return new SessionCommand(command_id, pickle); 247 return new SessionCommand(command_id, pickle);
248 } 248 }
249 249
250 SessionCommand* BaseSessionService::CreateSetWindowAppNameCommand(
251 SessionID::id_type command_id,
252 SessionID::id_type window_id,
253 const std::string& app_name) {
254 // Use pickle to handle marshalling.
255 Pickle pickle;
256 pickle.WriteInt(window_id);
257
258 // Enforce a max for ids. They should never be anywhere near this size.
259 static const SessionCommand::size_type max_id_size =
260 std::numeric_limits<SessionCommand::size_type>::max() - 1024;
261
262 int bytes_written = 0;
263
264 WriteStringToPickle(pickle, &bytes_written, max_id_size, app_name);
265
266 return new SessionCommand(command_id, pickle);
267 }
268
250 bool BaseSessionService::RestoreUpdateTabNavigationCommand( 269 bool BaseSessionService::RestoreUpdateTabNavigationCommand(
251 const SessionCommand& command, 270 const SessionCommand& command,
252 TabNavigation* navigation, 271 TabNavigation* navigation,
253 SessionID::id_type* tab_id) { 272 SessionID::id_type* tab_id) {
254 scoped_ptr<Pickle> pickle(command.PayloadAsPickle()); 273 scoped_ptr<Pickle> pickle(command.PayloadAsPickle());
255 if (!pickle.get()) 274 if (!pickle.get())
256 return false; 275 return false;
257 void* iterator = NULL; 276 void* iterator = NULL;
258 std::string url_spec; 277 std::string url_spec;
259 if (!pickle->ReadInt(&iterator, tab_id) || 278 if (!pickle->ReadInt(&iterator, tab_id) ||
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 std::string* extension_app_id) { 323 std::string* extension_app_id) {
305 scoped_ptr<Pickle> pickle(command.PayloadAsPickle()); 324 scoped_ptr<Pickle> pickle(command.PayloadAsPickle());
306 if (!pickle.get()) 325 if (!pickle.get())
307 return false; 326 return false;
308 327
309 void* iterator = NULL; 328 void* iterator = NULL;
310 return pickle->ReadInt(&iterator, tab_id) && 329 return pickle->ReadInt(&iterator, tab_id) &&
311 pickle->ReadString(&iterator, extension_app_id); 330 pickle->ReadString(&iterator, extension_app_id);
312 } 331 }
313 332
333 bool BaseSessionService::RestoreSetWindowAppNameCommand(
334 const SessionCommand& command,
335 SessionID::id_type* window_id,
336 std::string* app_name) {
337 scoped_ptr<Pickle> pickle(command.PayloadAsPickle());
338 if (!pickle.get())
339 return false;
340
341 void* iterator = NULL;
342 return pickle->ReadInt(&iterator, window_id) &&
343 pickle->ReadString(&iterator, app_name);
344 }
345
314 bool BaseSessionService::ShouldTrackEntry(const GURL& url) { 346 bool BaseSessionService::ShouldTrackEntry(const GURL& url) {
315 // NOTE: Do not track print preview tab because re-opening that page will 347 // NOTE: Do not track print preview tab because re-opening that page will
316 // just display a non-functional print preview page. 348 // just display a non-functional print preview page.
317 return url.is_valid() && url != GURL(chrome::kChromeUIPrintURL); 349 return url.is_valid() && url != GURL(chrome::kChromeUIPrintURL);
318 } 350 }
319 351
320 BaseSessionService::Handle BaseSessionService::ScheduleGetLastSessionCommands( 352 BaseSessionService::Handle BaseSessionService::ScheduleGetLastSessionCommands(
321 InternalGetCommandsRequest* request, 353 InternalGetCommandsRequest* request,
322 CancelableRequestConsumerBase* consumer) { 354 CancelableRequestConsumerBase* consumer) {
323 scoped_refptr<InternalGetCommandsRequest> request_wrapper(request); 355 scoped_refptr<InternalGetCommandsRequest> request_wrapper(request);
(...skipping 15 matching lines...) Expand all
339 if (RunningInProduction()) { 371 if (RunningInProduction()) {
340 return BrowserThread::PostTask(BrowserThread::FILE, from_here, task); 372 return BrowserThread::PostTask(BrowserThread::FILE, from_here, task);
341 } else { 373 } else {
342 // Fall back to executing on the main thread if the file thread 374 // Fall back to executing on the main thread if the file thread
343 // has gone away (around shutdown time) or if we're running as 375 // has gone away (around shutdown time) or if we're running as
344 // part of a unit test that does not set profile_. 376 // part of a unit test that does not set profile_.
345 task.Run(); 377 task.Run();
346 return true; 378 return true;
347 } 379 }
348 } 380 }
OLDNEW
« no previous file with comments | « chrome/browser/sessions/base_session_service.h ('k') | chrome/browser/sessions/session_restore.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698