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

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

Issue 10826141: Formalise a CHECK for the NULL NavigationEntry in ScriptBadgeController, and (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: add URL parameter Created 8 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
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/browser/extensions/script_executor.h" 5 #include "chrome/browser/extensions/script_executor.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/pickle.h" 9 #include "base/pickle.h"
10 #include "chrome/common/extensions/extension_messages.h" 10 #include "chrome/common/extensions/extension_messages.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 59
60 IPC_BEGIN_MESSAGE_MAP(Handler, message) 60 IPC_BEGIN_MESSAGE_MAP(Handler, message)
61 IPC_MESSAGE_HANDLER(ExtensionHostMsg_ExecuteCodeFinished, 61 IPC_MESSAGE_HANDLER(ExtensionHostMsg_ExecuteCodeFinished,
62 OnExecuteCodeFinished) 62 OnExecuteCodeFinished)
63 IPC_END_MESSAGE_MAP() 63 IPC_END_MESSAGE_MAP()
64 return true; 64 return true;
65 } 65 }
66 66
67 virtual void WebContentsDestroyed(content::WebContents* tab) OVERRIDE { 67 virtual void WebContentsDestroyed(content::WebContents* tab) OVERRIDE {
68 base::ListValue val; 68 base::ListValue val;
69 callback_.Run(false, -1, kRendererDestroyed, val); 69 callback_.Run(kRendererDestroyed, -1, GURL(""), val);
70 delete this; 70 delete this;
71 } 71 }
72 72
73 private: 73 private:
74 void OnExecuteCodeFinished(int request_id, 74 void OnExecuteCodeFinished(int request_id,
75 bool success,
76 int32 page_id,
77 const std::string& error, 75 const std::string& error,
76 int32 on_page_id,
77 const GURL& on_url,
78 const base::ListValue& script_result) { 78 const base::ListValue& script_result) {
79 if (observer_list_) { 79 if (observer_list_) {
80 FOR_EACH_OBSERVER(ScriptExecutor::Observer, *observer_list_, 80 FOR_EACH_OBSERVER(ScriptExecutor::Observer, *observer_list_,
81 OnExecuteScriptFinished(extension_id_, success, 81 OnExecuteScriptFinished(extension_id_, error,
82 page_id, error, script_result)); 82 on_page_id, on_url,
83 script_result));
83 } 84 }
84 85
85 callback_.Run(success, page_id, error, script_result); 86 callback_.Run(error, on_page_id, on_url, script_result);
86 delete this; 87 delete this;
87 } 88 }
88 89
89 base::WeakPtr<ObserverList<ScriptExecutor::Observer> > observer_list_; 90 base::WeakPtr<ObserverList<ScriptExecutor::Observer> > observer_list_;
90 std::string extension_id_; 91 std::string extension_id_;
91 int request_id_; 92 int request_id_;
92 ScriptExecutor::ExecuteScriptCallback callback_; 93 ScriptExecutor::ExecuteScriptCallback callback_;
93 }; 94 };
94 95
95 } // namespace 96 } // namespace
(...skipping 28 matching lines...) Expand all
124 params.code = code; 125 params.code = code;
125 params.all_frames = (frame_scope == ALL_FRAMES); 126 params.all_frames = (frame_scope == ALL_FRAMES);
126 params.run_at = static_cast<int>(run_at); 127 params.run_at = static_cast<int>(run_at);
127 params.in_main_world = (world_type == MAIN_WORLD); 128 params.in_main_world = (world_type == MAIN_WORLD);
128 129
129 // Handler handles IPCs and deletes itself on completion. 130 // Handler handles IPCs and deletes itself on completion.
130 new Handler(&observer_list_, web_contents_, params, callback); 131 new Handler(&observer_list_, web_contents_, params, callback);
131 } 132 }
132 133
133 } // namespace extensions 134 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698