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

Side by Side Diff: chrome/browser/extensions/api/sessions/sessions_api.cc

Issue 59743002: Do not leak a DictionaryValue from SessionsRestoreFunction::SetResultRestoredTab. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/extensions/api/sessions/sessions_api.h" 5 #include "chrome/browser/extensions/api/sessions/sessions_api.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/i18n/rtl.h" 9 #include "base/i18n/rtl.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 return true; 386 return true;
387 } 387 }
388 388
389 void SessionsRestoreFunction::SetInvalidIdError(const std::string& invalid_id) { 389 void SessionsRestoreFunction::SetInvalidIdError(const std::string& invalid_id) {
390 SetError(ErrorUtils::FormatErrorMessage(kInvalidSessionIdError, invalid_id)); 390 SetError(ErrorUtils::FormatErrorMessage(kInvalidSessionIdError, invalid_id));
391 } 391 }
392 392
393 393
394 void SessionsRestoreFunction::SetResultRestoredTab( 394 void SessionsRestoreFunction::SetResultRestoredTab(
395 const content::WebContents* contents) { 395 const content::WebContents* contents) {
396 scoped_ptr<tabs::Tab> tab(tabs::Tab::FromValue( 396 scoped_ptr<DictionaryValue> tab_value(
397 *ExtensionTabUtil::CreateTabValue(contents, GetExtension()))); 397 ExtensionTabUtil::CreateTabValue(contents, GetExtension()));
398 scoped_ptr<tabs::Tab> tab(tabs::Tab::FromValue(*tab_value));
398 scoped_ptr<api::sessions::Session> restored_session(CreateSessionModelHelper( 399 scoped_ptr<api::sessions::Session> restored_session(CreateSessionModelHelper(
399 base::Time::Now().ToTimeT(), 400 base::Time::Now().ToTimeT(),
400 tab.Pass(), 401 tab.Pass(),
401 scoped_ptr<windows::Window>())); 402 scoped_ptr<windows::Window>()));
402 results_ = Restore::Results::Create(*restored_session); 403 results_ = Restore::Results::Create(*restored_session);
403 } 404 }
404 405
405 bool SessionsRestoreFunction::SetResultRestoredWindow(int window_id) { 406 bool SessionsRestoreFunction::SetResultRestoredWindow(int window_id) {
406 WindowController* controller = NULL; 407 WindowController* controller = NULL;
407 if (!windows_util::GetWindowFromWindowID(this, window_id, &controller)) { 408 if (!windows_util::GetWindowFromWindowID(this, window_id, &controller)) {
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 static base::LazyInstance<ProfileKeyedAPIFactory<SessionsAPI> > 583 static base::LazyInstance<ProfileKeyedAPIFactory<SessionsAPI> >
583 g_factory = LAZY_INSTANCE_INITIALIZER; 584 g_factory = LAZY_INSTANCE_INITIALIZER;
584 585
585 // static 586 // static
586 ProfileKeyedAPIFactory<SessionsAPI>* 587 ProfileKeyedAPIFactory<SessionsAPI>*
587 SessionsAPI::GetFactoryInstance() { 588 SessionsAPI::GetFactoryInstance() {
588 return &g_factory.Get(); 589 return &g_factory.Get();
589 } 590 }
590 591
591 } // namespace extensions 592 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698