OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/automation_provider_observers.h" | 5 #include "chrome/browser/automation/automation_provider_observers.h" |
6 | 6 |
7 #include <deque> | 7 #include <deque> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 61 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
62 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" | 62 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" |
63 #include "chrome/browser/ui/webui/ntp/most_visited_handler.h" | 63 #include "chrome/browser/ui/webui/ntp/most_visited_handler.h" |
64 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" | 64 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" |
65 #include "chrome/browser/ui/webui/ntp/recently_closed_tabs_handler.h" | 65 #include "chrome/browser/ui/webui/ntp/recently_closed_tabs_handler.h" |
66 #include "chrome/common/automation_constants.h" | 66 #include "chrome/common/automation_constants.h" |
67 #include "chrome/common/automation_messages.h" | 67 #include "chrome/common/automation_messages.h" |
68 #include "chrome/common/chrome_notification_types.h" | 68 #include "chrome/common/chrome_notification_types.h" |
69 #include "chrome/common/content_settings_types.h" | 69 #include "chrome/common/content_settings_types.h" |
70 #include "chrome/common/extensions/extension.h" | 70 #include "chrome/common/extensions/extension.h" |
| 71 #include "chrome/common/extensions/manifest.h" |
71 #include "chrome/common/view_type.h" | 72 #include "chrome/common/view_type.h" |
72 #include "content/public/browser/dom_operation_notification_details.h" | 73 #include "content/public/browser/dom_operation_notification_details.h" |
73 #include "content/public/browser/navigation_controller.h" | 74 #include "content/public/browser/navigation_controller.h" |
74 #include "content/public/browser/notification_service.h" | 75 #include "content/public/browser/notification_service.h" |
75 #include "content/public/browser/render_process_host.h" | 76 #include "content/public/browser/render_process_host.h" |
76 #include "content/public/browser/render_view_host.h" | 77 #include "content/public/browser/render_view_host.h" |
77 #include "content/public/browser/web_contents.h" | 78 #include "content/public/browser/web_contents.h" |
78 #include "content/public/common/process_type.h" | 79 #include "content/public/common/process_type.h" |
79 #include "googleurl/src/gurl.h" | 80 #include "googleurl/src/gurl.h" |
80 #include "ui/gfx/codec/png_codec.h" | 81 #include "ui/gfx/codec/png_codec.h" |
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 case content::NOTIFICATION_LOAD_STOP: | 624 case content::NOTIFICATION_LOAD_STOP: |
624 // Only continue on with this method if our extension has been loaded | 625 // Only continue on with this method if our extension has been loaded |
625 // and all the extension views have stopped loading. | 626 // and all the extension views have stopped loading. |
626 if (!extension_ || !DidExtensionViewsStopLoading(manager_)) | 627 if (!extension_ || !DidExtensionViewsStopLoading(manager_)) |
627 return; | 628 return; |
628 break; | 629 break; |
629 case chrome::NOTIFICATION_EXTENSION_LOADED: { | 630 case chrome::NOTIFICATION_EXTENSION_LOADED: { |
630 const extensions::Extension* loaded_extension = | 631 const extensions::Extension* loaded_extension = |
631 content::Details<const extensions::Extension>(details).ptr(); | 632 content::Details<const extensions::Extension>(details).ptr(); |
632 // Only track an internal or unpacked extension load. | 633 // Only track an internal or unpacked extension load. |
633 extensions::Extension::Location location = loaded_extension->location(); | 634 extensions::Manifest::Location location = loaded_extension->location(); |
634 if (location != extensions::Extension::INTERNAL && | 635 if (location != extensions::Manifest::INTERNAL && |
635 location != extensions::Extension::LOAD) | 636 location != extensions::Manifest::LOAD) |
636 return; | 637 return; |
637 extension_ = loaded_extension; | 638 extension_ = loaded_extension; |
638 if (!DidExtensionViewsStopLoading(manager_)) | 639 if (!DidExtensionViewsStopLoading(manager_)) |
639 return; | 640 return; |
640 // For some reason, the background extension view is not yet | 641 // For some reason, the background extension view is not yet |
641 // created at this point so just checking whether all extension views | 642 // created at this point so just checking whether all extension views |
642 // are loaded is not sufficient. If background page is not ready, | 643 // are loaded is not sufficient. If background page is not ready, |
643 // we wait for NOTIFICATION_LOAD_STOP. | 644 // we wait for NOTIFICATION_LOAD_STOP. |
644 if (!service_->IsBackgroundPageReady(extension_)) | 645 if (!service_->IsBackgroundPageReady(extension_)) |
645 return; | 646 return; |
(...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1868 ExtensionService* ext_service) { | 1869 ExtensionService* ext_service) { |
1869 std::vector<DictionaryValue*>* apps_list = | 1870 std::vector<DictionaryValue*>* apps_list = |
1870 new std::vector<DictionaryValue*>(); | 1871 new std::vector<DictionaryValue*>(); |
1871 for (ExtensionSet::const_iterator ext = extensions->begin(); | 1872 for (ExtensionSet::const_iterator ext = extensions->begin(); |
1872 ext != extensions->end(); ++ext) { | 1873 ext != extensions->end(); ++ext) { |
1873 // Only return information about extensions that are actually apps. | 1874 // Only return information about extensions that are actually apps. |
1874 if ((*ext)->is_app()) { | 1875 if ((*ext)->is_app()) { |
1875 DictionaryValue* app_info = new DictionaryValue(); | 1876 DictionaryValue* app_info = new DictionaryValue(); |
1876 AppLauncherHandler::CreateAppInfo(*ext, NULL, ext_service, app_info); | 1877 AppLauncherHandler::CreateAppInfo(*ext, NULL, ext_service, app_info); |
1877 app_info->SetBoolean("is_component_extension", | 1878 app_info->SetBoolean("is_component_extension", |
1878 (*ext)->location() == extensions::Extension::COMPONENT); | 1879 (*ext)->location() == extensions::Manifest::COMPONENT); |
1879 | 1880 |
1880 // Convert the launch_type integer into a more descriptive string. | 1881 // Convert the launch_type integer into a more descriptive string. |
1881 int launch_type; | 1882 int launch_type; |
1882 const char* kLaunchType = "launch_type"; | 1883 const char* kLaunchType = "launch_type"; |
1883 if (!app_info->GetInteger(kLaunchType, &launch_type)) { | 1884 if (!app_info->GetInteger(kLaunchType, &launch_type)) { |
1884 NOTREACHED() << "Can't get integer from key " << kLaunchType; | 1885 NOTREACHED() << "Can't get integer from key " << kLaunchType; |
1885 continue; | 1886 continue; |
1886 } | 1887 } |
1887 if (launch_type == extensions::ExtensionPrefs::LAUNCH_PINNED) { | 1888 if (launch_type == extensions::ExtensionPrefs::LAUNCH_PINNED) { |
1888 app_info->SetString(kLaunchType, "pinned"); | 1889 app_info->SetString(kLaunchType, "pinned"); |
(...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2841 if (automation_) { | 2842 if (automation_) { |
2842 AutomationJSONReply(automation_, reply_message_.release()) | 2843 AutomationJSONReply(automation_, reply_message_.release()) |
2843 .SendSuccess(NULL); | 2844 .SendSuccess(NULL); |
2844 } | 2845 } |
2845 delete this; | 2846 delete this; |
2846 } | 2847 } |
2847 } else { | 2848 } else { |
2848 NOTREACHED(); | 2849 NOTREACHED(); |
2849 } | 2850 } |
2850 } | 2851 } |
OLD | NEW |