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

Side by Side Diff: chrome/browser/extensions/execute_code_in_tab_function.cc

Issue 7661009: base: Add Is* functions to Value class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tony review Created 9 years, 4 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/extensions/execute_code_in_tab_function.h" 5 #include "chrome/browser/extensions/execute_code_in_tab_function.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 } 53 }
54 54
55 execute_tab_id_ = -1; 55 execute_tab_id_ = -1;
56 Browser* browser = NULL; 56 Browser* browser = NULL;
57 TabContentsWrapper* contents = NULL; 57 TabContentsWrapper* contents = NULL;
58 58
59 // If |tab_id| is specified, look for it. Otherwise default to selected tab 59 // If |tab_id| is specified, look for it. Otherwise default to selected tab
60 // in the current window. 60 // in the current window.
61 Value* tab_value = NULL; 61 Value* tab_value = NULL;
62 EXTENSION_FUNCTION_VALIDATE(args_->Get(0, &tab_value)); 62 EXTENSION_FUNCTION_VALIDATE(args_->Get(0, &tab_value));
63 if (tab_value->IsType(Value::TYPE_NULL)) { 63 if (tab_value->IsNull()) {
64 browser = GetCurrentBrowser(); 64 browser = GetCurrentBrowser();
65 if (!browser) { 65 if (!browser) {
66 error_ = keys::kNoCurrentWindowError; 66 error_ = keys::kNoCurrentWindowError;
67 return false; 67 return false;
68 } 68 }
69 if (!ExtensionTabUtil::GetDefaultTab(browser, &contents, &execute_tab_id_)) 69 if (!ExtensionTabUtil::GetDefaultTab(browser, &contents, &execute_tab_id_))
70 return false; 70 return false;
71 } else { 71 } else {
72 EXTENSION_FUNCTION_VALIDATE(tab_value->GetAsInteger(&execute_tab_id_)); 72 EXTENSION_FUNCTION_VALIDATE(tab_value->GetAsInteger(&execute_tab_id_));
73 if (!ExtensionTabUtil::GetTabById(execute_tab_id_, profile(), 73 if (!ExtensionTabUtil::GetTabById(execute_tab_id_, profile(),
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 if (!error.empty()) { 210 if (!error.empty()) {
211 CHECK(!success); 211 CHECK(!success);
212 error_ = error; 212 error_ = error;
213 } 213 }
214 214
215 SendResponse(success); 215 SendResponse(success);
216 216
217 Observe(NULL); 217 Observe(NULL);
218 Release(); // balanced in Execute() 218 Release(); // balanced in Execute()
219 } 219 }
OLDNEW
« no previous file with comments | « chrome/browser/debugger/extension_ports_remote_service.cc ('k') | chrome/browser/extensions/extension_bookmarks_module.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698