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

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

Issue 12313142: Revert 184837 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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 | 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 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 // some alternative way to transmit the icon data to the browser process. 502 // some alternative way to transmit the icon data to the browser process.
503 // 503 //
504 // See also: bug 63729. 504 // See also: bug 63729.
505 const size_t kMaxIconSize = 1024 * 128; 505 const size_t kMaxIconSize = 1024 * 128;
506 size_t actual_icon_size = 0; 506 size_t actual_icon_size = 0;
507 for (size_t i = 0; i < pending_app_info_->icons.size(); ++i) { 507 for (size_t i = 0; i < pending_app_info_->icons.size(); ++i) {
508 size_t current_size = pending_app_info_->icons[i].data.getSize(); 508 size_t current_size = pending_app_info_->icons[i].data.getSize();
509 if (current_size > kMaxIconSize - actual_icon_size) { 509 if (current_size > kMaxIconSize - actual_icon_size) {
510 AddMessageToRootConsole( 510 AddMessageToRootConsole(
511 content::CONSOLE_MESSAGE_LEVEL_ERROR, 511 content::CONSOLE_MESSAGE_LEVEL_ERROR,
512 "Icons are too large. Maximum total size for app icons is 128 KB."); 512 ASCIIToUTF16("Icons are too large. "
513 "Maximum total size for app icons is 128 KB."));
513 return; 514 return;
514 } 515 }
515 actual_icon_size += current_size; 516 actual_icon_size += current_size;
516 } 517 }
517 518
518 Send(new ExtensionHostMsg_InstallApplication( 519 Send(new ExtensionHostMsg_InstallApplication(
519 routing_id(), *pending_app_info_)); 520 routing_id(), *pending_app_info_));
520 pending_app_info_.reset(NULL); 521 pending_app_info_.reset(NULL);
521 } 522 }
522 523
523 void ExtensionHelper::AddMessageToRootConsole(ConsoleMessageLevel level, 524 void ExtensionHelper::AddMessageToRootConsole(ConsoleMessageLevel level,
524 const std::string& message) {
525 AddMessageToRootConsole(level, ASCIIToUTF16(message));
526 }
527
528 void ExtensionHelper::AddMessageToRootConsole(ConsoleMessageLevel level,
529 const string16& message) { 525 const string16& message) {
530 if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) { 526 if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) {
531 WebConsoleMessage::Level target_level = WebConsoleMessage::LevelLog; 527 WebConsoleMessage::Level target_level = WebConsoleMessage::LevelLog;
532 switch (level) { 528 switch (level) {
533 case content::CONSOLE_MESSAGE_LEVEL_DEBUG: 529 case content::CONSOLE_MESSAGE_LEVEL_DEBUG:
534 target_level = WebConsoleMessage::LevelDebug; 530 target_level = WebConsoleMessage::LevelDebug;
535 break; 531 break;
536 case content::CONSOLE_MESSAGE_LEVEL_LOG: 532 case content::CONSOLE_MESSAGE_LEVEL_LOG:
537 target_level = WebConsoleMessage::LevelLog; 533 target_level = WebConsoleMessage::LevelLog;
538 break; 534 break;
539 case content::CONSOLE_MESSAGE_LEVEL_WARNING: 535 case content::CONSOLE_MESSAGE_LEVEL_WARNING:
540 target_level = WebConsoleMessage::LevelWarning; 536 target_level = WebConsoleMessage::LevelWarning;
541 break; 537 break;
542 case content::CONSOLE_MESSAGE_LEVEL_ERROR: 538 case content::CONSOLE_MESSAGE_LEVEL_ERROR:
543 target_level = WebConsoleMessage::LevelError; 539 target_level = WebConsoleMessage::LevelError;
544 break; 540 break;
545 } 541 }
546 render_view()->GetWebView()->mainFrame()->addMessageToConsole( 542 render_view()->GetWebView()->mainFrame()->addMessageToConsole(
547 WebConsoleMessage(target_level, message)); 543 WebConsoleMessage(target_level, message));
548 } 544 }
549 } 545 }
550 546
551 } // namespace extensions 547 } // 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