| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/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> |
| (...skipping 3174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3185 // Sample json input: { "command": "GetInstantInfo" } | 3185 // Sample json input: { "command": "GetInstantInfo" } |
| 3186 void TestingAutomationProvider::GetInstantInfo(Browser* browser, | 3186 void TestingAutomationProvider::GetInstantInfo(Browser* browser, |
| 3187 DictionaryValue* args, | 3187 DictionaryValue* args, |
| 3188 IPC::Message* reply_message) { | 3188 IPC::Message* reply_message) { |
| 3189 DictionaryValue* info = new DictionaryValue; | 3189 DictionaryValue* info = new DictionaryValue; |
| 3190 if (chrome::BrowserInstantController::IsInstantEnabled(browser->profile()) && | 3190 if (chrome::BrowserInstantController::IsInstantEnabled(browser->profile()) && |
| 3191 browser->instant_controller()) { | 3191 browser->instant_controller()) { |
| 3192 InstantController* instant = browser->instant_controller()->instant(); | 3192 InstantController* instant = browser->instant_controller()->instant(); |
| 3193 info->SetBoolean("enabled", true); | 3193 info->SetBoolean("enabled", true); |
| 3194 info->SetBoolean("active", (instant->GetPreviewContents() != NULL)); | 3194 info->SetBoolean("active", (instant->GetPreviewContents() != NULL)); |
| 3195 info->SetBoolean("current", instant->IsCurrent()); | 3195 info->SetBoolean("current", instant->IsCurrentSearch()); |
| 3196 if (instant->GetPreviewContents()) { | 3196 if (instant->GetPreviewContents()) { |
| 3197 WebContents* contents = instant->GetPreviewContents(); | 3197 WebContents* contents = instant->GetPreviewContents(); |
| 3198 info->SetBoolean("loading", contents->IsLoading()); | 3198 info->SetBoolean("loading", contents->IsLoading()); |
| 3199 info->SetString("location", contents->GetURL().spec()); | 3199 info->SetString("location", contents->GetURL().spec()); |
| 3200 info->SetString("title", contents->GetTitle()); | 3200 info->SetString("title", contents->GetTitle()); |
| 3201 } | 3201 } |
| 3202 } else { | 3202 } else { |
| 3203 info->SetBoolean("enabled", false); | 3203 info->SetBoolean("enabled", false); |
| 3204 } | 3204 } |
| 3205 scoped_ptr<DictionaryValue> return_value(new DictionaryValue); | 3205 scoped_ptr<DictionaryValue> return_value(new DictionaryValue); |
| (...skipping 3158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6364 if (g_browser_process) | 6364 if (g_browser_process) |
| 6365 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); | 6365 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); |
| 6366 } | 6366 } |
| 6367 | 6367 |
| 6368 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, | 6368 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, |
| 6369 WebContents* tab) { | 6369 WebContents* tab) { |
| 6370 TabStripModel* tab_strip = browser->tab_strip_model(); | 6370 TabStripModel* tab_strip = browser->tab_strip_model(); |
| 6371 if (tab_strip->GetActiveWebContents() != tab) | 6371 if (tab_strip->GetActiveWebContents() != tab) |
| 6372 tab_strip->ActivateTabAt(tab_strip->GetIndexOfWebContents(tab), true); | 6372 tab_strip->ActivateTabAt(tab_strip->GetIndexOfWebContents(tab), true); |
| 6373 } | 6373 } |
| OLD | NEW |