| 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_page_actions_
api.h" | 5 #include "chrome/browser/extensions/api/extension_action/extension_page_actions_
api.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
| 10 #include "chrome/browser/extensions/api/extension_action/extension_page_actions_
api_constants.h" | 10 #include "chrome/browser/extensions/api/extension_action/extension_page_actions_
api_constants.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 if (!entry || url != entry->GetURL().spec()) { | 92 if (!entry || url != entry->GetURL().spec()) { |
| 93 error_ = ExtensionErrorUtils::FormatErrorMessage(kUrlNotActiveError, url); | 93 error_ = ExtensionErrorUtils::FormatErrorMessage(kUrlNotActiveError, url); |
| 94 return false; | 94 return false; |
| 95 } | 95 } |
| 96 | 96 |
| 97 // Set visibility and broadcast notifications that the UI should be updated. | 97 // Set visibility and broadcast notifications that the UI should be updated. |
| 98 page_action->SetAppearance( | 98 page_action->SetAppearance( |
| 99 tab_id, enable ? ExtensionAction::ACTIVE : ExtensionAction::INVISIBLE); | 99 tab_id, enable ? ExtensionAction::ACTIVE : ExtensionAction::INVISIBLE); |
| 100 page_action->SetTitle(tab_id, title); | 100 page_action->SetTitle(tab_id, title); |
| 101 page_action->SetIconIndex(tab_id, icon_id); | 101 page_action->SetIconIndex(tab_id, icon_id); |
| 102 contents->extension_tab_helper()->location_bar_controller()->NotifyChange(); | 102 extensions::TabHelper::FromWebContents(contents->web_contents())-> |
| 103 location_bar_controller()->NotifyChange(); |
| 103 | 104 |
| 104 return true; | 105 return true; |
| 105 } | 106 } |
| 106 | 107 |
| 107 bool EnablePageActionsFunction::RunImpl() { | 108 bool EnablePageActionsFunction::RunImpl() { |
| 108 return SetPageActionEnabled(true); | 109 return SetPageActionEnabled(true); |
| 109 } | 110 } |
| 110 | 111 |
| 111 bool DisablePageActionsFunction::RunImpl() { | 112 bool DisablePageActionsFunction::RunImpl() { |
| 112 return SetPageActionEnabled(false); | 113 return SetPageActionEnabled(false); |
| 113 } | 114 } |
| OLD | NEW |