| 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/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 ExtensionActionFunction::ExtensionActionFunction() | 511 ExtensionActionFunction::ExtensionActionFunction() |
| 512 : details_(NULL), | 512 : details_(NULL), |
| 513 tab_id_(ExtensionAction::kDefaultTabId), | 513 tab_id_(ExtensionAction::kDefaultTabId), |
| 514 contents_(NULL), | 514 contents_(NULL), |
| 515 extension_action_(NULL) { | 515 extension_action_(NULL) { |
| 516 } | 516 } |
| 517 | 517 |
| 518 ExtensionActionFunction::~ExtensionActionFunction() { | 518 ExtensionActionFunction::~ExtensionActionFunction() { |
| 519 } | 519 } |
| 520 | 520 |
| 521 bool ExtensionActionFunction::RunImpl() { | 521 bool ExtensionActionFunction::RunSync() { |
| 522 ExtensionActionManager* manager = ExtensionActionManager::Get(GetProfile()); | 522 ExtensionActionManager* manager = ExtensionActionManager::Get(GetProfile()); |
| 523 const Extension* extension = GetExtension(); | 523 const Extension* extension = GetExtension(); |
| 524 if (StartsWithASCII(name(), "systemIndicator.", false)) { | 524 if (StartsWithASCII(name(), "systemIndicator.", false)) { |
| 525 extension_action_ = manager->GetSystemIndicator(*extension); | 525 extension_action_ = manager->GetSystemIndicator(*extension); |
| 526 } else { | 526 } else { |
| 527 extension_action_ = manager->GetBrowserAction(*extension); | 527 extension_action_ = manager->GetBrowserAction(*extension); |
| 528 if (!extension_action_) { | 528 if (!extension_action_) { |
| 529 extension_action_ = manager->GetPageAction(*extension); | 529 extension_action_ = manager->GetPageAction(*extension); |
| 530 } | 530 } |
| 531 } | 531 } |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 914 | 914 |
| 915 // Set visibility and broadcast notifications that the UI should be updated. | 915 // Set visibility and broadcast notifications that the UI should be updated. |
| 916 page_action->SetIsVisible(tab_id, enable); | 916 page_action->SetIsVisible(tab_id, enable); |
| 917 page_action->SetTitle(tab_id, title); | 917 page_action->SetTitle(tab_id, title); |
| 918 extensions::TabHelper::FromWebContents(contents)-> | 918 extensions::TabHelper::FromWebContents(contents)-> |
| 919 location_bar_controller()->NotifyChange(); | 919 location_bar_controller()->NotifyChange(); |
| 920 | 920 |
| 921 return true; | 921 return true; |
| 922 } | 922 } |
| 923 | 923 |
| 924 bool EnablePageActionsFunction::RunImpl() { | 924 bool EnablePageActionsFunction::RunSync() { |
| 925 return SetPageActionEnabled(true); | 925 return SetPageActionEnabled(true); |
| 926 } | 926 } |
| 927 | 927 |
| 928 bool DisablePageActionsFunction::RunImpl() { | 928 bool DisablePageActionsFunction::RunSync() { |
| 929 return SetPageActionEnabled(false); | 929 return SetPageActionEnabled(false); |
| 930 } | 930 } |
| OLD | NEW |