| 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 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 } | 625 } |
| 626 | 626 |
| 627 void ExtensionActionFunction::NotifyBrowserActionChange() { | 627 void ExtensionActionFunction::NotifyBrowserActionChange() { |
| 628 content::NotificationService::current()->Notify( | 628 content::NotificationService::current()->Notify( |
| 629 chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED, | 629 chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED, |
| 630 content::Source<ExtensionAction>(extension_action_), | 630 content::Source<ExtensionAction>(extension_action_), |
| 631 content::Details<Profile>(GetProfile())); | 631 content::Details<Profile>(GetProfile())); |
| 632 } | 632 } |
| 633 | 633 |
| 634 void ExtensionActionFunction::NotifyLocationBarChange() { | 634 void ExtensionActionFunction::NotifyLocationBarChange() { |
| 635 TabHelper::FromWebContents(contents_)-> | 635 LocationBarController::NotifyChange(contents_); |
| 636 location_bar_controller()->NotifyChange(); | |
| 637 } | 636 } |
| 638 | 637 |
| 639 void ExtensionActionFunction::NotifySystemIndicatorChange() { | 638 void ExtensionActionFunction::NotifySystemIndicatorChange() { |
| 640 content::NotificationService::current()->Notify( | 639 content::NotificationService::current()->Notify( |
| 641 chrome::NOTIFICATION_EXTENSION_SYSTEM_INDICATOR_UPDATED, | 640 chrome::NOTIFICATION_EXTENSION_SYSTEM_INDICATOR_UPDATED, |
| 642 content::Source<Profile>(GetProfile()), | 641 content::Source<Profile>(GetProfile()), |
| 643 content::Details<ExtensionAction>(extension_action_)); | 642 content::Details<ExtensionAction>(extension_action_)); |
| 644 } | 643 } |
| 645 | 644 |
| 646 bool ExtensionActionFunction::SetVisible(bool visible) { | 645 bool ExtensionActionFunction::SetVisible(bool visible) { |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 902 content::NavigationEntry* entry = contents->GetController().GetVisibleEntry(); | 901 content::NavigationEntry* entry = contents->GetController().GetVisibleEntry(); |
| 903 if (!entry || url != entry->GetURL().spec()) { | 902 if (!entry || url != entry->GetURL().spec()) { |
| 904 error_ = extensions::ErrorUtils::FormatErrorMessage( | 903 error_ = extensions::ErrorUtils::FormatErrorMessage( |
| 905 extensions::kUrlNotActiveError, url); | 904 extensions::kUrlNotActiveError, url); |
| 906 return false; | 905 return false; |
| 907 } | 906 } |
| 908 | 907 |
| 909 // Set visibility and broadcast notifications that the UI should be updated. | 908 // Set visibility and broadcast notifications that the UI should be updated. |
| 910 page_action->SetIsVisible(tab_id, enable); | 909 page_action->SetIsVisible(tab_id, enable); |
| 911 page_action->SetTitle(tab_id, title); | 910 page_action->SetTitle(tab_id, title); |
| 912 extensions::TabHelper::FromWebContents(contents)-> | 911 extensions::LocationBarController::NotifyChange(contents); |
| 913 location_bar_controller()->NotifyChange(); | |
| 914 | 912 |
| 915 return true; | 913 return true; |
| 916 } | 914 } |
| 917 | 915 |
| 918 bool EnablePageActionsFunction::RunSync() { | 916 bool EnablePageActionsFunction::RunSync() { |
| 919 return SetPageActionEnabled(true); | 917 return SetPageActionEnabled(true); |
| 920 } | 918 } |
| 921 | 919 |
| 922 bool DisablePageActionsFunction::RunSync() { | 920 bool DisablePageActionsFunction::RunSync() { |
| 923 return SetPageActionEnabled(false); | 921 return SetPageActionEnabled(false); |
| 924 } | 922 } |
| OLD | NEW |