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 #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 1531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1542 int handle, | 1542 int handle, |
1543 std::string* bookmarks_as_json, | 1543 std::string* bookmarks_as_json, |
1544 bool *success) { | 1544 bool *success) { |
1545 *success = false; | 1545 *success = false; |
1546 if (browser_tracker_->ContainsHandle(handle)) { | 1546 if (browser_tracker_->ContainsHandle(handle)) { |
1547 Browser* browser = browser_tracker_->GetResource(handle); | 1547 Browser* browser = browser_tracker_->GetResource(handle); |
1548 if (browser) { | 1548 if (browser) { |
1549 if (!browser->profile()->GetBookmarkModel()->IsLoaded()) { | 1549 if (!browser->profile()->GetBookmarkModel()->IsLoaded()) { |
1550 return; | 1550 return; |
1551 } | 1551 } |
1552 scoped_refptr<BookmarkStorage> storage = new BookmarkStorage( | 1552 scoped_refptr<BookmarkStorage> storage(new BookmarkStorage( |
1553 browser->profile(), | 1553 browser->profile(), |
1554 browser->profile()->GetBookmarkModel()); | 1554 browser->profile()->GetBookmarkModel())); |
1555 *success = storage->SerializeData(bookmarks_as_json); | 1555 *success = storage->SerializeData(bookmarks_as_json); |
1556 } | 1556 } |
1557 } | 1557 } |
1558 } | 1558 } |
1559 | 1559 |
1560 void TestingAutomationProvider::WaitForBookmarkModelToLoad( | 1560 void TestingAutomationProvider::WaitForBookmarkModelToLoad( |
1561 int handle, | 1561 int handle, |
1562 IPC::Message* reply_message) { | 1562 IPC::Message* reply_message) { |
1563 if (browser_tracker_->ContainsHandle(handle)) { | 1563 if (browser_tracker_->ContainsHandle(handle)) { |
1564 Browser* browser = browser_tracker_->GetResource(handle); | 1564 Browser* browser = browser_tracker_->GetResource(handle); |
(...skipping 2646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4211 DCHECK(type == NotificationType::SESSION_END); | 4211 DCHECK(type == NotificationType::SESSION_END); |
4212 // OnBrowserRemoved does a ReleaseLater. When session end is received we exit | 4212 // OnBrowserRemoved does a ReleaseLater. When session end is received we exit |
4213 // before the task runs resulting in this object not being deleted. This | 4213 // before the task runs resulting in this object not being deleted. This |
4214 // Release balance out the Release scheduled by OnBrowserRemoved. | 4214 // Release balance out the Release scheduled by OnBrowserRemoved. |
4215 Release(); | 4215 Release(); |
4216 } | 4216 } |
4217 | 4217 |
4218 void TestingAutomationProvider::OnRemoveProvider() { | 4218 void TestingAutomationProvider::OnRemoveProvider() { |
4219 AutomationProviderList::GetInstance()->RemoveProvider(this); | 4219 AutomationProviderList::GetInstance()->RemoveProvider(this); |
4220 } | 4220 } |
OLD | NEW |