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

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

Issue 10800031: Remove details from BROWSER_CLOSING and BROWSER_CLOSED notifications. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed automation Created 8 years, 4 months 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 | chrome/browser/profiles/profile_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "chrome/browser/automation/automation_provider_observers.h" 5 #include "chrome/browser/automation/automation_provider_observers.h"
6 6
7 #include <deque> 7 #include <deque>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 860 matching lines...) Expand 10 before | Expand all | Expand 10 after
871 void BrowserClosedNotificationObserver::Observe( 871 void BrowserClosedNotificationObserver::Observe(
872 int type, const content::NotificationSource& source, 872 int type, const content::NotificationSource& source,
873 const content::NotificationDetails& details) { 873 const content::NotificationDetails& details) {
874 DCHECK(type == chrome::NOTIFICATION_BROWSER_CLOSED); 874 DCHECK(type == chrome::NOTIFICATION_BROWSER_CLOSED);
875 875
876 if (!automation_) { 876 if (!automation_) {
877 delete this; 877 delete this;
878 return; 878 return;
879 } 879 }
880 880
881 content::Details<bool> close_app(details); 881 int browser_count = static_cast<int>(BrowserList::size());
882 // We get the notification before the browser is removed from the BrowserList.
883 bool app_closing = browser_count == 1;
882 884
883 if (use_json_interface_) { 885 if (use_json_interface_) {
884 AutomationJSONReply(automation_, 886 AutomationJSONReply(automation_,
885 reply_message_.release()).SendSuccess(NULL); 887 reply_message_.release()).SendSuccess(NULL);
886 } else { 888 } else {
887 if (for_browser_command_) { 889 if (for_browser_command_) {
888 AutomationMsg_WindowExecuteCommand::WriteReplyParams(reply_message_.get(), 890 AutomationMsg_WindowExecuteCommand::WriteReplyParams(reply_message_.get(),
889 true); 891 true);
890 } else { 892 } else {
891 AutomationMsg_CloseBrowser::WriteReplyParams(reply_message_.get(), true, 893 AutomationMsg_CloseBrowser::WriteReplyParams(reply_message_.get(), true,
892 *(close_app.ptr())); 894 app_closing);
893 } 895 }
894 automation_->Send(reply_message_.release()); 896 automation_->Send(reply_message_.release());
895 } 897 }
896 delete this; 898 delete this;
897 } 899 }
898 900
899 void BrowserClosedNotificationObserver::set_for_browser_command( 901 void BrowserClosedNotificationObserver::set_for_browser_command(
900 bool for_browser_command) { 902 bool for_browser_command) {
901 for_browser_command_ = for_browser_command; 903 for_browser_command_ = for_browser_command;
902 } 904 }
(...skipping 2249 matching lines...) Expand 10 before | Expand all | Expand 10 after
3152 if (automation_) { 3154 if (automation_) {
3153 AutomationJSONReply(automation_, reply_message_.release()) 3155 AutomationJSONReply(automation_, reply_message_.release())
3154 .SendSuccess(NULL); 3156 .SendSuccess(NULL);
3155 } 3157 }
3156 delete this; 3158 delete this;
3157 } 3159 }
3158 } else { 3160 } else {
3159 NOTREACHED(); 3161 NOTREACHED();
3160 } 3162 }
3161 } 3163 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/profiles/profile_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698