OLD | NEW |
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 // 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/bind.h" | 9 #include "base/bind.h" |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 break; | 94 break; |
95 | 95 |
96 default: | 96 default: |
97 NOTREACHED(); | 97 NOTREACHED(); |
98 } | 98 } |
99 dict->SetString(keys::kCauseKey, cause); | 99 dict->SetString(keys::kCauseKey, cause); |
100 | 100 |
101 args.Append(dict); | 101 args.Append(dict); |
102 | 102 |
103 std::string json_args; | 103 std::string json_args; |
104 base::JSONWriter::Write(&args, false, &json_args); | 104 base::JSONWriter::Write(&args, &json_args); |
105 GURL cookie_domain = | 105 GURL cookie_domain = |
106 extension_cookies_helpers::GetURLFromCanonicalCookie(*details->cookie); | 106 extension_cookies_helpers::GetURLFromCanonicalCookie(*details->cookie); |
107 DispatchEvent(profile, keys::kOnChanged, json_args, cookie_domain); | 107 DispatchEvent(profile, keys::kOnChanged, json_args, cookie_domain); |
108 } | 108 } |
109 | 109 |
110 void ExtensionCookiesEventRouter::DispatchEvent(Profile* profile, | 110 void ExtensionCookiesEventRouter::DispatchEvent(Profile* profile, |
111 const char* event_name, | 111 const char* event_name, |
112 const std::string& json_args, | 112 const std::string& json_args, |
113 GURL& cookie_domain) { | 113 GURL& cookie_domain) { |
114 if (profile && profile->GetExtensionEventRouter()) { | 114 if (profile && profile->GetExtensionEventRouter()) { |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 extension_cookies_helpers::CreateCookieStoreValue( | 534 extension_cookies_helpers::CreateCookieStoreValue( |
535 incognito_profile, incognito_tab_ids.release())); | 535 incognito_profile, incognito_tab_ids.release())); |
536 } | 536 } |
537 result_.reset(cookie_store_list); | 537 result_.reset(cookie_store_list); |
538 return true; | 538 return true; |
539 } | 539 } |
540 | 540 |
541 void GetAllCookieStoresFunction::Run() { | 541 void GetAllCookieStoresFunction::Run() { |
542 SendResponse(RunImpl()); | 542 SendResponse(RunImpl()); |
543 } | 543 } |
OLD | NEW |