OLD | NEW |
---|---|
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/extension_action/extension_action_api.h" | 5 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" |
6 | 6 |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
370 tab_id_(ExtensionAction::kDefaultTabId), | 370 tab_id_(ExtensionAction::kDefaultTabId), |
371 contents_(NULL), | 371 contents_(NULL), |
372 extension_action_(NULL) { | 372 extension_action_(NULL) { |
373 } | 373 } |
374 | 374 |
375 ExtensionActionFunction::~ExtensionActionFunction() { | 375 ExtensionActionFunction::~ExtensionActionFunction() { |
376 } | 376 } |
377 | 377 |
378 bool ExtensionActionFunction::RunSync() { | 378 bool ExtensionActionFunction::RunSync() { |
379 ExtensionActionManager* manager = ExtensionActionManager::Get(GetProfile()); | 379 ExtensionActionManager* manager = ExtensionActionManager::Get(GetProfile()); |
380 if (base::StartsWithASCII(name(), "systemIndicator.", false)) { | 380 if (base::StartsWith(name(), "systemIndicator.", |
Nico
2015/07/06 17:55:00
(this looks strange too. asked the original author
| |
381 base::CompareCase::INSENSITIVE_ASCII)) { | |
381 extension_action_ = manager->GetSystemIndicator(*extension()); | 382 extension_action_ = manager->GetSystemIndicator(*extension()); |
382 } else { | 383 } else { |
383 extension_action_ = manager->GetBrowserAction(*extension()); | 384 extension_action_ = manager->GetBrowserAction(*extension()); |
384 if (!extension_action_) { | 385 if (!extension_action_) { |
385 extension_action_ = manager->GetPageAction(*extension()); | 386 extension_action_ = manager->GetPageAction(*extension()); |
386 } | 387 } |
387 } | 388 } |
388 if (!extension_action_) { | 389 if (!extension_action_) { |
389 // TODO(kalman): ideally the browserAction/pageAction APIs wouldn't event | 390 // TODO(kalman): ideally the browserAction/pageAction APIs wouldn't event |
390 // exist for extensions that don't have one declared. This should come as | 391 // exist for extensions that don't have one declared. This should come as |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
677 if (host->extension_host_type() != VIEW_TYPE_EXTENSION_POPUP || | 678 if (host->extension_host_type() != VIEW_TYPE_EXTENSION_POPUP || |
678 host->extension()->id() != extension_->id()) | 679 host->extension()->id() != extension_->id()) |
679 return; | 680 return; |
680 | 681 |
681 SendResponse(true); | 682 SendResponse(true); |
682 response_sent_ = true; | 683 response_sent_ = true; |
683 registrar_.RemoveAll(); | 684 registrar_.RemoveAll(); |
684 } | 685 } |
685 | 686 |
686 } // namespace extensions | 687 } // namespace extensions |
OLD | NEW |