Skip to content

Commit

Permalink
Extract ParsedCookie into a top level class
Browse files Browse the repository at this point in the history
BUG=137014,112155
TEST=no
TBR=sky@chromium.org, rdsmith@chromium.org, jochen@chromium.org

Review URL: https://chromiumcodereview.appspot.com/10689158

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@146324 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
battre@chromium.org committed Jul 12, 2012
1 parent 5a76f9b commit ebfe317
Show file tree
Hide file tree
Showing 18 changed files with 746 additions and 667 deletions.
3 changes: 2 additions & 1 deletion chrome/browser/browsing_data_cookie_helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "content/public/browser/browser_thread.h"
#include "googleurl/src/gurl.h"
#include "net/base/registry_controlled_domain.h"
#include "net/cookies/parsed_cookie.h"
#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_context_getter.h"

Expand Down Expand Up @@ -131,7 +132,7 @@ void CannedBrowsingDataCookieHelper::AddChangedCookie(
const GURL& url,
const std::string& cookie_line,
const net::CookieOptions& options) {
net::CookieMonster::ParsedCookie parsed_cookie(cookie_line);
net::ParsedCookie parsed_cookie(cookie_line);
if (options.exclude_httponly() && parsed_cookie.IsHttpOnly()) {
// Return if a Javascript cookie illegally specified the HTTP only flag.
return;
Expand Down
3 changes: 2 additions & 1 deletion chrome/browser/browsing_data_cookie_helper_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "base/synchronization/waitable_event.h"
#include "chrome/test/base/testing_profile.h"
#include "content/public/test/test_browser_thread.h"
#include "net/cookies/parsed_cookie.h"
#include "net/url_request/url_request_context_getter.h"
#include "testing/gtest/include/gtest/gtest.h"

Expand Down Expand Up @@ -195,7 +196,7 @@ TEST_F(BrowsingDataCookieHelperTest, CannedEmpty) {
ASSERT_TRUE(helper->empty());

net::CookieList cookies;
net::CookieMonster::ParsedCookie pc("a=1");
net::ParsedCookie pc("a=1");
scoped_ptr<net::CookieMonster::CanonicalCookie> cookie(
new net::CookieMonster::CanonicalCookie(url_google, pc));
cookies.push_back(*cookie);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "chrome/test/base/testing_profile.h"
#include "content/public/test/test_browser_thread.h"
#include "net/cookies/cookie_monster.h"
#include "net/cookies/parsed_cookie.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/gmock/include/gmock/gmock.h"

Expand Down Expand Up @@ -188,7 +189,7 @@ TEST_F(TabSpecificContentSettingsTest, SiteDataObserver) {
net::CookieOptions(),
blocked_by_policy);
net::CookieList cookie_list;
net::CookieMonster::ParsedCookie parsed_cookie("CookieName=CookieValue");
net::ParsedCookie parsed_cookie("CookieName=CookieValue");
scoped_ptr<net::CookieMonster::CanonicalCookie> cookie(
net::CookieMonster::CanonicalCookie::Create(GURL("http://google.com"),
parsed_cookie));
Expand Down
3 changes: 2 additions & 1 deletion chrome/browser/mock_browsing_data_cookie_helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "chrome/browser/mock_browsing_data_cookie_helper.h"

#include "base/logging.h"
#include "net/cookies/parsed_cookie.h"

MockBrowsingDataCookieHelper::MockBrowsingDataCookieHelper(
net::URLRequestContextGetter* request_context_getter)
Expand All @@ -29,7 +30,7 @@ void MockBrowsingDataCookieHelper::DeleteCookie(
void MockBrowsingDataCookieHelper::AddCookieSamples(
const GURL& url, const std::string& cookie_line) {
typedef net::CookieList::const_iterator cookie_iterator;
net::CookieMonster::ParsedCookie pc(cookie_line);
net::ParsedCookie pc(cookie_line);
scoped_ptr<net::CookieMonster::CanonicalCookie> cc;
cc.reset(new net::CookieMonster::CanonicalCookie(url, pc));

Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/net/gaia/gaia_oauth_fetcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "chrome/common/net/url_util.h"
#include "grit/chromium_strings.h"
#include "net/base/load_flags.h"
#include "net/cookies/cookie_monster.h"
#include "net/cookies/parsed_cookie.h"
#include "net/http/http_status_code.h"
#include "net/url_request/url_fetcher.h"
#include "net/url_request/url_request_context_getter.h"
Expand Down Expand Up @@ -418,7 +418,7 @@ void GaiaOAuthFetcher::OnGetOAuthTokenUrlFetched(
if (status.is_success() && response_code == net::HTTP_OK) {
for (net::ResponseCookies::const_iterator iter = cookies.begin();
iter != cookies.end(); ++iter) {
net::CookieMonster::ParsedCookie cookie(*iter);
net::ParsedCookie cookie(*iter);
if (cookie.Name() == kOAuthTokenCookie) {
std::string token = cookie.Value();
consumer_->OnGetOAuthTokenSuccess(token);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#import "chrome/browser/ui/cocoa/cocoa_test_helper.h"
#include "chrome/browser/ui/cocoa/content_settings/cookie_details.h"
#include "googleurl/src/gurl.h"
#include "net/cookies/parsed_cookie.h"
#import "testing/gtest_mac.h"

namespace {
Expand All @@ -25,7 +26,7 @@
GURL url("http://chromium.org");
std::string cookieLine(
"PHPSESSID=0123456789abcdef0123456789abcdef; path=/");
net::CookieMonster::ParsedCookie pc(cookieLine);
net::ParsedCookie pc(cookieLine);
net::CookieMonster::CanonicalCookie cookie(url, pc);
NSString* origin = base::SysUTF8ToNSString("http://chromium.org");
details.reset([[CocoaCookieDetails alloc] initWithCookie:&cookie
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "base/sys_string_conversions.h"
#include "chrome/browser/ui/cocoa/cocoa_test_helper.h"
#include "chrome/browser/ui/cocoa/content_settings/cookie_details.h"
#include "chrome/browser/ui/cocoa/content_settings/cookie_details_view_controller.h"
#include "net/cookies/parsed_cookie.h"

namespace {

Expand All @@ -16,7 +17,7 @@
GURL url("http://chromium.org");
std::string cookieLine(
"PHPSESSID=0123456789abcdef0123456789abcdef; path=/");
net::CookieMonster::ParsedCookie pc(cookieLine);
net::ParsedCookie pc(cookieLine);
net::CookieMonster::CanonicalCookie cookie(url, pc);
NSString* origin = base::SysUTF8ToNSString("http://chromium.org");
CocoaCookieDetails* details = [CocoaCookieDetails alloc];
Expand Down
3 changes: 2 additions & 1 deletion chrome/browser/ui/gtk/gtk_chrome_cookie_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "base/i18n/time_formatting.h"
#include "base/utf_string_conversions.h"
#include "grit/generated_resources.h"
#include "net/cookies/parsed_cookie.h"
#include "ui/base/gtk/gtk_hig_constants.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/text/bytes_formatting.h"
Expand Down Expand Up @@ -517,7 +518,7 @@ void gtk_chrome_cookie_view_display_cookie_string(
GtkChromeCookieView* self,
const GURL& url,
const std::string& cookie_line) {
net::CookieMonster::ParsedCookie pc(cookie_line);
net::ParsedCookie pc(cookie_line);
net::CookieMonster::CanonicalCookie cookie(url, pc);

gtk_chrome_cookie_view_display_cookie(
Expand Down
3 changes: 2 additions & 1 deletion chrome/browser/ui/views/cookie_info_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "chrome/browser/cookies_tree_model.h"
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
#include "net/cookies/parsed_cookie.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/color_utils.h"
Expand Down Expand Up @@ -95,7 +96,7 @@ void CookieInfoView::SetCookie(

void CookieInfoView::SetCookieString(const GURL& url,
const std::string& cookie_line) {
net::CookieMonster::ParsedCookie pc(cookie_line);
net::ParsedCookie pc(cookie_line);
net::CookieMonster::CanonicalCookie cookie(url, pc);
SetCookie(pc.HasDomain() ? pc.Domain() : url.host(), cookie);
}
Expand Down
Loading

0 comments on commit ebfe317

Please sign in to comment.