OLD | NEW |
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> |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 #include "chrome/browser/download/save_package_file_picker.h" | 51 #include "chrome/browser/download/save_package_file_picker.h" |
52 #include "chrome/browser/extensions/browser_action_test_util.h" | 52 #include "chrome/browser/extensions/browser_action_test_util.h" |
53 #include "chrome/browser/extensions/crx_installer.h" | 53 #include "chrome/browser/extensions/crx_installer.h" |
54 #include "chrome/browser/extensions/extension_action.h" | 54 #include "chrome/browser/extensions/extension_action.h" |
55 #include "chrome/browser/extensions/extension_action_manager.h" | 55 #include "chrome/browser/extensions/extension_action_manager.h" |
56 #include "chrome/browser/extensions/extension_host.h" | 56 #include "chrome/browser/extensions/extension_host.h" |
57 #include "chrome/browser/extensions/extension_service.h" | 57 #include "chrome/browser/extensions/extension_service.h" |
58 #include "chrome/browser/extensions/extension_system.h" | 58 #include "chrome/browser/extensions/extension_system.h" |
59 #include "chrome/browser/extensions/extension_tab_util.h" | 59 #include "chrome/browser/extensions/extension_tab_util.h" |
60 #include "chrome/browser/extensions/extension_util.h" | 60 #include "chrome/browser/extensions/extension_util.h" |
| 61 #include "chrome/browser/extensions/launch_util.h" |
61 #include "chrome/browser/extensions/unpacked_installer.h" | 62 #include "chrome/browser/extensions/unpacked_installer.h" |
62 #include "chrome/browser/extensions/updater/extension_updater.h" | 63 #include "chrome/browser/extensions/updater/extension_updater.h" |
63 #include "chrome/browser/history/history_service_factory.h" | 64 #include "chrome/browser/history/history_service_factory.h" |
64 #include "chrome/browser/history/top_sites.h" | 65 #include "chrome/browser/history/top_sites.h" |
65 #include "chrome/browser/infobars/confirm_infobar_delegate.h" | 66 #include "chrome/browser/infobars/confirm_infobar_delegate.h" |
66 #include "chrome/browser/infobars/infobar_service.h" | 67 #include "chrome/browser/infobars/infobar_service.h" |
67 #include "chrome/browser/lifetime/application_lifetime.h" | 68 #include "chrome/browser/lifetime/application_lifetime.h" |
68 #include "chrome/browser/notifications/balloon.h" | 69 #include "chrome/browser/notifications/balloon.h" |
69 #include "chrome/browser/notifications/balloon_collection.h" | 70 #include "chrome/browser/notifications/balloon_collection.h" |
70 #include "chrome/browser/notifications/balloon_notification_ui_manager.h" | 71 #include "chrome/browser/notifications/balloon_notification_ui_manager.h" |
(...skipping 4241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4312 } | 4313 } |
4313 | 4314 |
4314 const Extension* extension = service->GetExtensionById( | 4315 const Extension* extension = service->GetExtensionById( |
4315 id, true /* include disabled extensions */); | 4316 id, true /* include disabled extensions */); |
4316 if (!extension) { | 4317 if (!extension) { |
4317 reply.SendError(base::StringPrintf( | 4318 reply.SendError(base::StringPrintf( |
4318 "Extension with ID '%s' doesn't exist.", id.c_str())); | 4319 "Extension with ID '%s' doesn't exist.", id.c_str())); |
4319 return; | 4320 return; |
4320 } | 4321 } |
4321 | 4322 |
4322 extensions::ExtensionPrefs::LaunchType launch_type; | 4323 extensions::LaunchType launch_type; |
4323 if (launch_type_str == "pinned") { | 4324 if (launch_type_str == "pinned") { |
4324 launch_type = extensions::ExtensionPrefs::LAUNCH_TYPE_PINNED; | 4325 launch_type = extensions::LAUNCH_TYPE_PINNED; |
4325 } else if (launch_type_str == "regular") { | 4326 } else if (launch_type_str == "regular") { |
4326 launch_type = extensions::ExtensionPrefs::LAUNCH_TYPE_REGULAR; | 4327 launch_type = extensions::LAUNCH_TYPE_REGULAR; |
4327 } else if (launch_type_str == "fullscreen") { | 4328 } else if (launch_type_str == "fullscreen") { |
4328 launch_type = extensions::ExtensionPrefs::LAUNCH_TYPE_FULLSCREEN; | 4329 launch_type = extensions::LAUNCH_TYPE_FULLSCREEN; |
4329 } else if (launch_type_str == "window") { | 4330 } else if (launch_type_str == "window") { |
4330 launch_type = extensions::ExtensionPrefs::LAUNCH_TYPE_WINDOW; | 4331 launch_type = extensions::LAUNCH_TYPE_WINDOW; |
4331 } else { | 4332 } else { |
4332 reply.SendError(base::StringPrintf( | 4333 reply.SendError(base::StringPrintf( |
4333 "Unexpected launch type '%s'.", launch_type_str.c_str())); | 4334 "Unexpected launch type '%s'.", launch_type_str.c_str())); |
4334 return; | 4335 return; |
4335 } | 4336 } |
4336 | 4337 |
4337 service->extension_prefs()->SetLaunchType(extension->id(), launch_type); | 4338 extensions::SetLaunchType( |
| 4339 service->extension_prefs(), extension->id(), launch_type); |
4338 reply.SendSuccess(NULL); | 4340 reply.SendSuccess(NULL); |
4339 } | 4341 } |
4340 | 4342 |
4341 // Sample json input: { "command": "GetV8HeapStats", | 4343 // Sample json input: { "command": "GetV8HeapStats", |
4342 // "tab_index": 0 } | 4344 // "tab_index": 0 } |
4343 // Refer to GetV8HeapStats() in chrome/test/pyautolib/pyauto.py for | 4345 // Refer to GetV8HeapStats() in chrome/test/pyautolib/pyauto.py for |
4344 // sample json output. | 4346 // sample json output. |
4345 void TestingAutomationProvider::GetV8HeapStats( | 4347 void TestingAutomationProvider::GetV8HeapStats( |
4346 Browser* browser, | 4348 Browser* browser, |
4347 DictionaryValue* args, | 4349 DictionaryValue* args, |
(...skipping 1104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5452 if (g_browser_process) | 5454 if (g_browser_process) |
5453 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); | 5455 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); |
5454 } | 5456 } |
5455 | 5457 |
5456 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, | 5458 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, |
5457 WebContents* tab) { | 5459 WebContents* tab) { |
5458 TabStripModel* tab_strip = browser->tab_strip_model(); | 5460 TabStripModel* tab_strip = browser->tab_strip_model(); |
5459 if (tab_strip->GetActiveWebContents() != tab) | 5461 if (tab_strip->GetActiveWebContents() != tab) |
5460 tab_strip->ActivateTabAt(tab_strip->GetIndexOfWebContents(tab), true); | 5462 tab_strip->ActivateTabAt(tab_strip->GetIndexOfWebContents(tab), true); |
5461 } | 5463 } |
OLD | NEW |