| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // Implements the Chrome Extensions Cookies API. | 5 // Implements the Chrome Extensions Cookies API. |
| 6 | 6 |
| 7 #include "chrome/browser/extensions/extension_cookies_api.h" | 7 #include "chrome/browser/extensions/extension_cookies_api.h" |
| 8 | 8 |
| 9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
| 10 #include "base/task.h" | 10 #include "base/task.h" |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 void RemoveCookieFunction::Run() { | 418 void RemoveCookieFunction::Run() { |
| 419 SendResponse(RunImpl()); | 419 SendResponse(RunImpl()); |
| 420 } | 420 } |
| 421 | 421 |
| 422 bool GetAllCookieStoresFunction::RunImpl() { | 422 bool GetAllCookieStoresFunction::RunImpl() { |
| 423 Profile* original_profile = profile(); | 423 Profile* original_profile = profile(); |
| 424 DCHECK(original_profile); | 424 DCHECK(original_profile); |
| 425 scoped_ptr<ListValue> original_tab_ids(new ListValue()); | 425 scoped_ptr<ListValue> original_tab_ids(new ListValue()); |
| 426 Profile* incognito_profile = NULL; | 426 Profile* incognito_profile = NULL; |
| 427 scoped_ptr<ListValue> incognito_tab_ids; | 427 scoped_ptr<ListValue> incognito_tab_ids; |
| 428 if (include_incognito()) { | 428 if (include_incognito() && profile()->HasOffTheRecordProfile()) { |
| 429 incognito_profile = profile()->GetOffTheRecordProfile(); | 429 incognito_profile = profile()->GetOffTheRecordProfile(); |
| 430 if (incognito_profile) | 430 if (incognito_profile) |
| 431 incognito_tab_ids.reset(new ListValue()); | 431 incognito_tab_ids.reset(new ListValue()); |
| 432 } | 432 } |
| 433 DCHECK(original_profile != incognito_profile); | 433 DCHECK(original_profile != incognito_profile); |
| 434 | 434 |
| 435 // Iterate through all browser instances, and for each browser, | 435 // Iterate through all browser instances, and for each browser, |
| 436 // add its tab IDs to either the regular or incognito tab ID list depending | 436 // add its tab IDs to either the regular or incognito tab ID list depending |
| 437 // whether the browser is regular or incognito. | 437 // whether the browser is regular or incognito. |
| 438 for (BrowserList::const_iterator iter = BrowserList::begin(); | 438 for (BrowserList::const_iterator iter = BrowserList::begin(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 459 extension_cookies_helpers::CreateCookieStoreValue( | 459 extension_cookies_helpers::CreateCookieStoreValue( |
| 460 incognito_profile, incognito_tab_ids.release())); | 460 incognito_profile, incognito_tab_ids.release())); |
| 461 } | 461 } |
| 462 result_.reset(cookie_store_list); | 462 result_.reset(cookie_store_list); |
| 463 return true; | 463 return true; |
| 464 } | 464 } |
| 465 | 465 |
| 466 void GetAllCookieStoresFunction::Run() { | 466 void GetAllCookieStoresFunction::Run() { |
| 467 SendResponse(RunImpl()); | 467 SendResponse(RunImpl()); |
| 468 } | 468 } |
| OLD | NEW |