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

Side by Side Diff: chrome/browser/extensions/api/web_request/web_request_api.cc

Issue 332413003: Cleanup: Remove #ifdefs in extensions code that is disabled on mobile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 6 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/browser/extensions/api/web_request/web_request_api.h" 5 #include "chrome/browser/extensions/api/web_request/web_request_api.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 return; 408 return;
409 409
410 scoped_ptr<base::ListValue> event_args(new base::ListValue); 410 scoped_ptr<base::ListValue> event_args(new base::ListValue);
411 event_args->Append(event_argument.release()); 411 event_args->Append(event_argument.release());
412 412
413 extensions::EventRouter* event_router = extensions::EventRouter::Get(profile); 413 extensions::EventRouter* event_router = extensions::EventRouter::Get(profile);
414 414
415 extensions::EventFilteringInfo event_filtering_info; 415 extensions::EventFilteringInfo event_filtering_info;
416 416
417 std::string event_name; 417 std::string event_name;
418 #if defined(ENABLE_EXTENSIONS)
419 // The instance ID uniquely identifies a <webview> instance within an embedder 418 // The instance ID uniquely identifies a <webview> instance within an embedder
420 // process. We use a filter here so that only event listeners for a particular 419 // process. We use a filter here so that only event listeners for a particular
421 // <webview> will fire. 420 // <webview> will fire.
422 if (is_web_view_guest) { 421 if (is_web_view_guest) {
423 event_filtering_info.SetInstanceID(web_view_info.instance_id); 422 event_filtering_info.SetInstanceID(web_view_info.instance_id);
424 event_name = webview::kEventMessage; 423 event_name = webview::kEventMessage;
425 } else { 424 } else {
426 event_name = declarative_keys::kOnMessage; 425 event_name = declarative_keys::kOnMessage;
427 } 426 }
428 #else
429 // TODO(thestig) Remove this once the WebRequestAPI code is disabled.
430 // http://crbug.com/305852
431 NOTREACHED();
432 #endif
433 427
434 scoped_ptr<extensions::Event> event(new extensions::Event( 428 scoped_ptr<extensions::Event> event(new extensions::Event(
435 event_name, 429 event_name,
436 event_args.Pass(), profile, GURL(), 430 event_args.Pass(), profile, GURL(),
437 extensions::EventRouter::USER_GESTURE_UNKNOWN, 431 extensions::EventRouter::USER_GESTURE_UNKNOWN,
438 event_filtering_info)); 432 event_filtering_info));
439 event_router->DispatchEventToExtension(extension_id, event.Pass()); 433 event_router->DispatchEventToExtension(extension_id, event.Pass());
440 } 434 }
441 435
442 void RemoveEventListenerOnIOThread( 436 void RemoveEventListenerOnIOThread(
(...skipping 2033 matching lines...) Expand 10 before | Expand all | Expand 10 after
2476 extensions::RuntimeData* runtime_data = 2470 extensions::RuntimeData* runtime_data =
2477 extensions::ExtensionSystem::Get(profile)->runtime_data(); 2471 extensions::ExtensionSystem::Get(profile)->runtime_data();
2478 for (extensions::ExtensionSet::const_iterator it = extensions.begin(); 2472 for (extensions::ExtensionSet::const_iterator it = extensions.begin();
2479 !webrequest_used && it != extensions.end(); 2473 !webrequest_used && it != extensions.end();
2480 ++it) { 2474 ++it) {
2481 webrequest_used |= runtime_data->HasUsedWebRequest(it->get()); 2475 webrequest_used |= runtime_data->HasUsedWebRequest(it->get());
2482 } 2476 }
2483 2477
2484 host->Send(new ExtensionMsg_UsingWebRequestAPI(webrequest_used)); 2478 host->Send(new ExtensionMsg_UsingWebRequestAPI(webrequest_used));
2485 } 2479 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/tabs/tabs_api.cc ('k') | chrome/browser/guest_view/web_view/web_view_guest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698