OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/dom_ui/app_launcher_handler.h" | 5 #include "chrome/browser/dom_ui/app_launcher_handler.h" |
6 | 6 |
7 #include "app/resource_bundle.h" | 7 #include "app/resource_bundle.h" |
8 #include "base/base64.h" | 8 #include "base/base64.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 GURL icon_url = extension->GetResourceURL(path); | 82 GURL icon_url = extension->GetResourceURL(path); |
83 value->SetString(L"icon", icon_url.spec()); | 83 value->SetString(L"icon", icon_url.spec()); |
84 } | 84 } |
85 | 85 |
86 void AppLauncherHandler::HandleGetApps(const Value* value) { | 86 void AppLauncherHandler::HandleGetApps(const Value* value) { |
87 std::string gallery_title; | 87 std::string gallery_title; |
88 std::string gallery_url; | 88 std::string gallery_url; |
89 | 89 |
90 // TODO(aa): Decide the final values for these and remove the switches. | 90 // TODO(aa): Decide the final values for these and remove the switches. |
91 gallery_title = CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 91 gallery_title = CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
92 switches::kAppLauncherGalleryTitle); | 92 switches::kAppsGalleryTitle); |
93 gallery_url = CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 93 gallery_url = CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
94 switches::kAppLauncherGalleryURL); | 94 switches::kAppsGalleryURL); |
95 | 95 |
96 DictionaryValue dictionary; | 96 DictionaryValue dictionary; |
97 dictionary.SetString(L"galleryTitle", gallery_title); | 97 dictionary.SetString(L"galleryTitle", gallery_title); |
98 dictionary.SetString(L"galleryURL", gallery_url); | 98 dictionary.SetString(L"galleryURL", gallery_url); |
99 | 99 |
100 ListValue* list = new ListValue(); | 100 ListValue* list = new ListValue(); |
101 const ExtensionList* extensions = extensions_service_->extensions(); | 101 const ExtensionList* extensions = extensions_service_->extensions(); |
102 for (ExtensionList::const_iterator it = extensions->begin(); | 102 for (ExtensionList::const_iterator it = extensions->begin(); |
103 it != extensions->end(); ++it) { | 103 it != extensions->end(); ++it) { |
104 if (TreatAsApp(*it)) { | 104 if (TreatAsApp(*it)) { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 old_contents = browser->GetSelectedTabContents(); | 166 old_contents = browser->GetSelectedTabContents(); |
167 | 167 |
168 Browser::OpenApplication(profile, extension, container); | 168 Browser::OpenApplication(profile, extension, container); |
169 | 169 |
170 if (old_contents && | 170 if (old_contents && |
171 old_contents->GetURL().GetOrigin() == | 171 old_contents->GetURL().GetOrigin() == |
172 GURL(chrome::kChromeUINewTabURL).GetOrigin()) { | 172 GURL(chrome::kChromeUINewTabURL).GetOrigin()) { |
173 browser->CloseTabContents(old_contents); | 173 browser->CloseTabContents(old_contents); |
174 } | 174 } |
175 } | 175 } |
OLD | NEW |