Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: chrome/common/extensions/extension_file_util.cc

Issue 11644057: Move BrowserAction out of Extension (Closed) Base URL: http://git.chromium.org/chromium/src.git@dc_ungoop_extension_action
Patch Set: Latest master for CQ Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/common/extensions/extension_file_util.h" 5 #include "chrome/common/extensions/extension_file_util.h"
6 6
7 #include <map> 7 #include <map>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/file_path.h" 10 #include "base/file_path.h"
11 #include "base/file_util.h" 11 #include "base/file_util.h"
12 #include "base/files/scoped_temp_dir.h" 12 #include "base/files/scoped_temp_dir.h"
13 #include "base/json/json_file_value_serializer.h" 13 #include "base/json/json_file_value_serializer.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/metrics/histogram.h" 15 #include "base/metrics/histogram.h"
16 #include "base/path_service.h" 16 #include "base/path_service.h"
17 #include "base/stringprintf.h" 17 #include "base/stringprintf.h"
18 #include "base/threading/thread_restrictions.h" 18 #include "base/threading/thread_restrictions.h"
19 #include "base/utf_string_conversions.h" 19 #include "base/utf_string_conversions.h"
20 #include "chrome/common/chrome_constants.h" 20 #include "chrome/common/chrome_constants.h"
21 #include "chrome/common/chrome_paths.h" 21 #include "chrome/common/chrome_paths.h"
22 #include "chrome/common/extensions/api/extension_action/action_info.h" 22 #include "chrome/common/extensions/api/extension_action/action_info.h"
23 #include "chrome/common/extensions/api/extension_action/browser_action_handler.h "
23 #include "chrome/common/extensions/extension.h" 24 #include "chrome/common/extensions/extension.h"
24 #include "chrome/common/extensions/extension_l10n_util.h" 25 #include "chrome/common/extensions/extension_l10n_util.h"
25 #include "chrome/common/extensions/extension_manifest_constants.h" 26 #include "chrome/common/extensions/extension_manifest_constants.h"
26 #include "chrome/common/extensions/extension_messages.h" 27 #include "chrome/common/extensions/extension_messages.h"
27 #include "chrome/common/extensions/extension_resource.h" 28 #include "chrome/common/extensions/extension_resource.h"
28 #include "chrome/common/extensions/manifest_url_handler.h" 29 #include "chrome/common/extensions/manifest_url_handler.h"
29 #include "chrome/common/extensions/message_bundle.h" 30 #include "chrome/common/extensions/message_bundle.h"
30 #include "grit/generated_resources.h" 31 #include "grit/generated_resources.h"
31 #include "net/base/escape.h" 32 #include "net/base/escape.h"
32 #include "net/base/file_stream.h" 33 #include "net/base/file_stream.h"
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 } 330 }
330 } 331 }
331 332
332 const extensions::ActionInfo* action = extension->page_action_info(); 333 const extensions::ActionInfo* action = extension->page_action_info();
333 if (action && !action->default_icon.empty() && 334 if (action && !action->default_icon.empty() &&
334 !ValidateExtensionIconSet(action->default_icon, extension, 335 !ValidateExtensionIconSet(action->default_icon, extension,
335 IDS_EXTENSION_LOAD_ICON_FOR_PAGE_ACTION_FAILED, error)) { 336 IDS_EXTENSION_LOAD_ICON_FOR_PAGE_ACTION_FAILED, error)) {
336 return false; 337 return false;
337 } 338 }
338 339
339 action = extension->browser_action_info(); 340 action = extensions::ActionInfo::GetBrowserActionInfo(extension);
340 if (action && !action->default_icon.empty() && 341 if (action && !action->default_icon.empty() &&
341 !ValidateExtensionIconSet(action->default_icon, extension, 342 !ValidateExtensionIconSet(action->default_icon, extension,
342 IDS_EXTENSION_LOAD_ICON_FOR_BROWSER_ACTION_FAILED, error)) { 343 IDS_EXTENSION_LOAD_ICON_FOR_BROWSER_ACTION_FAILED, error)) {
343 return false; 344 return false;
344 } 345 }
345 346
346 // Validate that background scripts exist. 347 // Validate that background scripts exist.
347 for (size_t i = 0; i < extension->background_scripts().size(); ++i) { 348 for (size_t i = 0; i < extension->background_scripts().size(); ++i) {
348 if (!file_util::PathExists( 349 if (!file_util::PathExists(
349 extension->GetResource( 350 extension->GetResource(
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 return FilePath(); 757 return FilePath();
757 } 758 }
758 return temp_path; 759 return temp_path;
759 } 760 }
760 761
761 void DeleteFile(const FilePath& path, bool recursive) { 762 void DeleteFile(const FilePath& path, bool recursive) {
762 file_util::Delete(path, recursive); 763 file_util::Delete(path, recursive);
763 } 764 }
764 765
765 } // namespace extension_file_util 766 } // namespace extension_file_util
OLDNEW
« no previous file with comments | « chrome/common/extensions/extension.cc ('k') | chrome/common/extensions/extension_file_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698