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

Side by Side Diff: chrome/browser/automation/testing_automation_provider.cc

Issue 5254005: Do not reset the content settings delegate's cookies when a network error occurred. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome/browser/tab_contents
Patch Set: updates Created 10 years 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) 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 #include "chrome/browser/automation/testing_automation_provider.h" 5 #include "chrome/browser/automation/testing_automation_provider.h"
6 6
7 #include "app/message_box_flags.h" 7 #include "app/message_box_flags.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_CloseBrowser, CloseBrowser) 248 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_CloseBrowser, CloseBrowser)
249 IPC_MESSAGE_HANDLER(AutomationMsg_CloseBrowserRequestAsync, 249 IPC_MESSAGE_HANDLER(AutomationMsg_CloseBrowserRequestAsync,
250 CloseBrowserAsync) 250 CloseBrowserAsync)
251 IPC_MESSAGE_HANDLER(AutomationMsg_ActivateTab, ActivateTab) 251 IPC_MESSAGE_HANDLER(AutomationMsg_ActivateTab, ActivateTab)
252 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_AppendTab, AppendTab) 252 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_AppendTab, AppendTab)
253 IPC_MESSAGE_HANDLER(AutomationMsg_ActiveTabIndex, GetActiveTabIndex) 253 IPC_MESSAGE_HANDLER(AutomationMsg_ActiveTabIndex, GetActiveTabIndex)
254 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_CloseTab, CloseTab) 254 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_CloseTab, CloseTab)
255 IPC_MESSAGE_HANDLER(AutomationMsg_GetCookies, GetCookies) 255 IPC_MESSAGE_HANDLER(AutomationMsg_GetCookies, GetCookies)
256 IPC_MESSAGE_HANDLER(AutomationMsg_SetCookie, SetCookie) 256 IPC_MESSAGE_HANDLER(AutomationMsg_SetCookie, SetCookie)
257 IPC_MESSAGE_HANDLER(AutomationMsg_DeleteCookie, DeleteCookie) 257 IPC_MESSAGE_HANDLER(AutomationMsg_DeleteCookie, DeleteCookie)
258 IPC_MESSAGE_HANDLER(AutomationMsg_IsContentBlocked, IsContentBlocked)
259 IPC_MESSAGE_HANDLER(AutomationMsg_IsContentAccessed, IsContentAccessed)
258 IPC_MESSAGE_HANDLER(AutomationMsg_ShowCollectedCookiesDialog, 260 IPC_MESSAGE_HANDLER(AutomationMsg_ShowCollectedCookiesDialog,
259 ShowCollectedCookiesDialog) 261 ShowCollectedCookiesDialog)
260 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_NavigateToURL, NavigateToURL) 262 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_NavigateToURL, NavigateToURL)
261 IPC_MESSAGE_HANDLER_DELAY_REPLY( 263 IPC_MESSAGE_HANDLER_DELAY_REPLY(
262 AutomationMsg_NavigateToURLBlockUntilNavigationsComplete, 264 AutomationMsg_NavigateToURLBlockUntilNavigationsComplete,
263 NavigateToURLBlockUntilNavigationsComplete) 265 NavigateToURLBlockUntilNavigationsComplete)
264 IPC_MESSAGE_HANDLER(AutomationMsg_NavigationAsync, NavigationAsync) 266 IPC_MESSAGE_HANDLER(AutomationMsg_NavigationAsync, NavigationAsync)
265 IPC_MESSAGE_HANDLER(AutomationMsg_NavigationAsyncWithDisposition, 267 IPC_MESSAGE_HANDLER(AutomationMsg_NavigationAsyncWithDisposition,
266 NavigationAsyncWithDisposition) 268 NavigationAsyncWithDisposition)
267 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_GoBack, GoBack) 269 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_GoBack, GoBack)
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 NavigationController* tab = tab_tracker_->GetResource(handle); 570 NavigationController* tab = tab_tracker_->GetResource(handle);
569 BrowserThread::PostTask( 571 BrowserThread::PostTask(
570 BrowserThread::IO, FROM_HERE, 572 BrowserThread::IO, FROM_HERE,
571 new DeleteCookieTask( 573 new DeleteCookieTask(
572 url, cookie_name, 574 url, cookie_name,
573 make_scoped_refptr(tab->profile()->GetRequestContext()))); 575 make_scoped_refptr(tab->profile()->GetRequestContext())));
574 *success = true; 576 *success = true;
575 } 577 }
576 } 578 }
577 579
580 void TestingAutomationProvider::IsContentBlocked(
581 int handle,
582 ContentSettingsType content_type,
583 bool* is_blocked,
584 bool* success) {
585 *success = false;
586 if (tab_tracker_->ContainsHandle(handle)) {
587 TabSpecificContentSettings* content_settings = tab_tracker_->
588 GetResource(handle)->tab_contents()->GetTabSpecificContentSettings();
589 *is_blocked = content_settings->IsContentBlocked(content_type);
590 *success = true;
591 }
592 }
593
594 void TestingAutomationProvider::IsContentAccessed(
595 int handle,
596 ContentSettingsType content_type,
597 bool* is_accessed,
598 bool* success) {
599 *success = false;
600 if (tab_tracker_->ContainsHandle(handle)) {
601 TabSpecificContentSettings* content_settings = tab_tracker_->
602 GetResource(handle)->tab_contents()->GetTabSpecificContentSettings();
603 *is_accessed = content_settings->IsContentAccessed(content_type);
604 *success = true;
605 }
606 }
607
578 void TestingAutomationProvider::ShowCollectedCookiesDialog( 608 void TestingAutomationProvider::ShowCollectedCookiesDialog(
579 int handle, bool* success) { 609 int handle, bool* success) {
580 *success = false; 610 *success = false;
581 if (tab_tracker_->ContainsHandle(handle)) { 611 if (tab_tracker_->ContainsHandle(handle)) {
582 TabContents* tab_contents = 612 TabContents* tab_contents =
583 tab_tracker_->GetResource(handle)->tab_contents(); 613 tab_tracker_->GetResource(handle)->tab_contents();
584 tab_contents->delegate()->ShowCollectedCookiesDialog(tab_contents); 614 tab_contents->delegate()->ShowCollectedCookiesDialog(tab_contents);
585 *success = true; 615 *success = true;
586 } 616 }
587 } 617 }
(...skipping 3980 matching lines...) Expand 10 before | Expand all | Expand 10 after
4568 DCHECK(type == NotificationType::SESSION_END); 4598 DCHECK(type == NotificationType::SESSION_END);
4569 // OnBrowserRemoved does a ReleaseLater. When session end is received we exit 4599 // OnBrowserRemoved does a ReleaseLater. When session end is received we exit
4570 // before the task runs resulting in this object not being deleted. This 4600 // before the task runs resulting in this object not being deleted. This
4571 // Release balance out the Release scheduled by OnBrowserRemoved. 4601 // Release balance out the Release scheduled by OnBrowserRemoved.
4572 Release(); 4602 Release();
4573 } 4603 }
4574 4604
4575 void TestingAutomationProvider::OnRemoveProvider() { 4605 void TestingAutomationProvider::OnRemoveProvider() {
4576 AutomationProviderList::GetInstance()->RemoveProvider(this); 4606 AutomationProviderList::GetInstance()->RemoveProvider(this);
4577 } 4607 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698