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 3168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3179 void TestingAutomationProvider::GetInstantInfo(Browser* browser, | 3179 void TestingAutomationProvider::GetInstantInfo(Browser* browser, |
3180 DictionaryValue* args, | 3180 DictionaryValue* args, |
3181 IPC::Message* reply_message) { | 3181 IPC::Message* reply_message) { |
3182 DictionaryValue* info = new DictionaryValue; | 3182 DictionaryValue* info = new DictionaryValue; |
3183 if (chrome::BrowserInstantController::IsInstantEnabled(browser->profile()) && | 3183 if (chrome::BrowserInstantController::IsInstantEnabled(browser->profile()) && |
3184 browser->instant_controller()) { | 3184 browser->instant_controller()) { |
3185 InstantController* instant = browser->instant_controller()->instant(); | 3185 InstantController* instant = browser->instant_controller()->instant(); |
3186 info->SetBoolean("enabled", true); | 3186 info->SetBoolean("enabled", true); |
3187 info->SetBoolean("active", (instant->GetPreviewContents() != NULL)); | 3187 info->SetBoolean("active", (instant->GetPreviewContents() != NULL)); |
3188 info->SetBoolean("current", instant->IsCurrent()); | 3188 info->SetBoolean("current", instant->IsCurrent()); |
3189 if (instant->GetPreviewContents() && | 3189 if (instant->GetPreviewContents()) { |
3190 instant->GetPreviewContents()->web_contents()) { | 3190 WebContents* contents = instant->GetPreviewContents(); |
3191 WebContents* contents = instant->GetPreviewContents()->web_contents(); | |
3192 info->SetBoolean("loading", contents->IsLoading()); | 3191 info->SetBoolean("loading", contents->IsLoading()); |
3193 info->SetString("location", contents->GetURL().spec()); | 3192 info->SetString("location", contents->GetURL().spec()); |
3194 info->SetString("title", contents->GetTitle()); | 3193 info->SetString("title", contents->GetTitle()); |
3195 } | 3194 } |
3196 } else { | 3195 } else { |
3197 info->SetBoolean("enabled", false); | 3196 info->SetBoolean("enabled", false); |
3198 } | 3197 } |
3199 scoped_ptr<DictionaryValue> return_value(new DictionaryValue); | 3198 scoped_ptr<DictionaryValue> return_value(new DictionaryValue); |
3200 return_value->Set("instant", info); | 3199 return_value->Set("instant", info); |
3201 AutomationJSONReply(this, reply_message).SendSuccess(return_value.get()); | 3200 AutomationJSONReply(this, reply_message).SendSuccess(return_value.get()); |
(...skipping 3156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6358 if (g_browser_process) | 6357 if (g_browser_process) |
6359 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); | 6358 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); |
6360 } | 6359 } |
6361 | 6360 |
6362 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, | 6361 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, |
6363 WebContents* tab) { | 6362 WebContents* tab) { |
6364 TabStripModel* tab_strip = browser->tab_strip_model(); | 6363 TabStripModel* tab_strip = browser->tab_strip_model(); |
6365 if (tab_strip->GetActiveWebContents() != tab) | 6364 if (tab_strip->GetActiveWebContents() != tab) |
6366 tab_strip->ActivateTabAt(tab_strip->GetIndexOfWebContents(tab), true); | 6365 tab_strip->ActivateTabAt(tab_strip->GetIndexOfWebContents(tab), true); |
6367 } | 6366 } |
OLD | NEW |