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

Side by Side Diff: chrome/renderer/extensions/extension_helper.cc

Issue 11571014: Lazy load chrome.* APIs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: android compilation Created 7 years, 9 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 | Annotate | Revision Log
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/renderer/extensions/extension_helper.h" 5 #include "chrome/renderer/extensions/extension_helper.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/json/json_string_value_serializer.h" 10 #include "base/json/json_string_value_serializer.h"
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 // some alternative way to transmit the icon data to the browser process. 503 // some alternative way to transmit the icon data to the browser process.
504 // 504 //
505 // See also: bug 63729. 505 // See also: bug 63729.
506 const size_t kMaxIconSize = 1024 * 128; 506 const size_t kMaxIconSize = 1024 * 128;
507 size_t actual_icon_size = 0; 507 size_t actual_icon_size = 0;
508 for (size_t i = 0; i < pending_app_info_->icons.size(); ++i) { 508 for (size_t i = 0; i < pending_app_info_->icons.size(); ++i) {
509 size_t current_size = pending_app_info_->icons[i].data.getSize(); 509 size_t current_size = pending_app_info_->icons[i].data.getSize();
510 if (current_size > kMaxIconSize - actual_icon_size) { 510 if (current_size > kMaxIconSize - actual_icon_size) {
511 AddMessageToRootConsole( 511 AddMessageToRootConsole(
512 content::CONSOLE_MESSAGE_LEVEL_ERROR, 512 content::CONSOLE_MESSAGE_LEVEL_ERROR,
513 ASCIIToUTF16("Icons are too large. " 513 "Icons are too large. Maximum total size for app icons is 128 KB.");
514 "Maximum total size for app icons is 128 KB."));
515 return; 514 return;
516 } 515 }
517 actual_icon_size += current_size; 516 actual_icon_size += current_size;
518 } 517 }
519 518
520 Send(new ExtensionHostMsg_InstallApplication( 519 Send(new ExtensionHostMsg_InstallApplication(
521 routing_id(), *pending_app_info_)); 520 routing_id(), *pending_app_info_));
522 pending_app_info_.reset(NULL); 521 pending_app_info_.reset(NULL);
523 } 522 }
524 523
525 void ExtensionHelper::AddMessageToRootConsole(ConsoleMessageLevel level, 524 void ExtensionHelper::AddMessageToRootConsole(ConsoleMessageLevel level,
525 const std::string& message) {
526 AddMessageToRootConsole(level, ASCIIToUTF16(message));
527 }
528
529 void ExtensionHelper::AddMessageToRootConsole(ConsoleMessageLevel level,
526 const string16& message) { 530 const string16& message) {
527 if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) { 531 if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) {
528 WebConsoleMessage::Level target_level = WebConsoleMessage::LevelLog; 532 WebConsoleMessage::Level target_level = WebConsoleMessage::LevelLog;
529 switch (level) { 533 switch (level) {
530 case content::CONSOLE_MESSAGE_LEVEL_DEBUG: 534 case content::CONSOLE_MESSAGE_LEVEL_DEBUG:
531 target_level = WebConsoleMessage::LevelDebug; 535 target_level = WebConsoleMessage::LevelDebug;
532 break; 536 break;
533 case content::CONSOLE_MESSAGE_LEVEL_LOG: 537 case content::CONSOLE_MESSAGE_LEVEL_LOG:
534 target_level = WebConsoleMessage::LevelLog; 538 target_level = WebConsoleMessage::LevelLog;
535 break; 539 break;
536 case content::CONSOLE_MESSAGE_LEVEL_WARNING: 540 case content::CONSOLE_MESSAGE_LEVEL_WARNING:
537 target_level = WebConsoleMessage::LevelWarning; 541 target_level = WebConsoleMessage::LevelWarning;
538 break; 542 break;
539 case content::CONSOLE_MESSAGE_LEVEL_ERROR: 543 case content::CONSOLE_MESSAGE_LEVEL_ERROR:
540 target_level = WebConsoleMessage::LevelError; 544 target_level = WebConsoleMessage::LevelError;
541 break; 545 break;
542 } 546 }
543 render_view()->GetWebView()->mainFrame()->addMessageToConsole( 547 render_view()->GetWebView()->mainFrame()->addMessageToConsole(
544 WebConsoleMessage(target_level, message)); 548 WebConsoleMessage(target_level, message));
545 } 549 }
546 } 550 }
547 551
548 } // namespace extensions 552 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/extension_helper.h ('k') | chrome/renderer/extensions/file_browser_handler_custom_bindings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698