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

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

Issue 12952005: Delay bookmarks load while the profile is loading. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix testing_profile.h Created 7 years, 9 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/bind_helpers.h" 13 #include "base/bind_helpers.h"
14 #include "base/command_line.h" 14 #include "base/command_line.h"
15 #include "base/deferred_sequenced_task_runner.h"
15 #include "base/files/file_path.h" 16 #include "base/files/file_path.h"
16 #include "base/json/json_reader.h" 17 #include "base/json/json_reader.h"
17 #include "base/json/json_writer.h" 18 #include "base/json/json_writer.h"
18 #include "base/json/string_escape.h" 19 #include "base/json/string_escape.h"
19 #include "base/path_service.h" 20 #include "base/path_service.h"
20 #include "base/prefs/pref_service.h" 21 #include "base/prefs/pref_service.h"
21 #include "base/process.h" 22 #include "base/process.h"
22 #include "base/process_util.h" 23 #include "base/process_util.h"
23 #include "base/sequenced_task_runner.h" 24 #include "base/sequenced_task_runner.h"
24 #include "base/stringprintf.h" 25 #include "base/stringprintf.h"
(...skipping 1233 matching lines...) Expand 10 before | Expand all | Expand 10 after
1258 } 1259 }
1259 BookmarkModel* bookmark_model = 1260 BookmarkModel* bookmark_model =
1260 BookmarkModelFactory::GetForProfile(browser->profile()); 1261 BookmarkModelFactory::GetForProfile(browser->profile());
1261 if (!bookmark_model->IsLoaded()) { 1262 if (!bookmark_model->IsLoaded()) {
1262 reply.SendError("Bookmark model is not loaded"); 1263 reply.SendError("Bookmark model is not loaded");
1263 return; 1264 return;
1264 } 1265 }
1265 scoped_refptr<BookmarkStorage> storage( 1266 scoped_refptr<BookmarkStorage> storage(
1266 new BookmarkStorage(browser->profile(), 1267 new BookmarkStorage(browser->profile(),
1267 bookmark_model, 1268 bookmark_model,
1268 browser->profile()->GetIOTaskRunner())); 1269 browser->profile()->GetBookmarksTaskRunner()));
1269 if (!storage->SerializeData(&bookmarks_as_json)) { 1270 if (!storage->SerializeData(&bookmarks_as_json)) {
1270 reply.SendError("Failed to serialize bookmarks"); 1271 reply.SendError("Failed to serialize bookmarks");
1271 return; 1272 return;
1272 } 1273 }
1273 DictionaryValue dict; 1274 DictionaryValue dict;
1274 dict.SetString("bookmarks_as_json", bookmarks_as_json); 1275 dict.SetString("bookmarks_as_json", bookmarks_as_json);
1275 reply.SendSuccess(&dict); 1276 reply.SendSuccess(&dict);
1276 } 1277 }
1277 1278
1278 void TestingAutomationProvider::WaitForBookmarkModelToLoad( 1279 void TestingAutomationProvider::WaitForBookmarkModelToLoad(
(...skipping 4639 matching lines...) Expand 10 before | Expand all | Expand 10 after
5918 if (g_browser_process) 5919 if (g_browser_process)
5919 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); 5920 g_browser_process->GetAutomationProviderList()->RemoveProvider(this);
5920 } 5921 }
5921 5922
5922 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, 5923 void TestingAutomationProvider::EnsureTabSelected(Browser* browser,
5923 WebContents* tab) { 5924 WebContents* tab) {
5924 TabStripModel* tab_strip = browser->tab_strip_model(); 5925 TabStripModel* tab_strip = browser->tab_strip_model();
5925 if (tab_strip->GetActiveWebContents() != tab) 5926 if (tab_strip->GetActiveWebContents() != tab)
5926 tab_strip->ActivateTabAt(tab_strip->GetIndexOfWebContents(tab), true); 5927 tab_strip->ActivateTabAt(tab_strip->GetIndexOfWebContents(tab), true);
5927 } 5928 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698