Chromium Code Reviews| Index: chrome/browser/extensions/manager_actions.cc |
| =================================================================== |
| --- chrome/browser/extensions/manager_actions.cc (revision 0) |
| +++ chrome/browser/extensions/manager_actions.cc (revision 0) |
| @@ -0,0 +1,114 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// User of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include <string> |
| +#include "chrome/browser/extensions/manager_actions.h" |
| + |
| +namespace activity { |
| + |
| +ManagerAction::ManagerAction(const std::string& extension_id, |
| + const ManagerActionType& verb, |
| + const ManagerTargetType& target, |
| + const std::string& api_call, |
| + const base::Time& time) |
| + : extension_id_(extension_id), |
|
mvrable
2012/12/04 01:00:13
There should be four spaces of indentation before
felt
2012/12/07 19:27:45
Done.
|
| + verb_(verb), |
| + target_(target), |
| + api_call_(api_call), |
| + time_(time) { } |
| + |
| +std::string ManagerAction::PrettyPrintForil8n() { |
| + // TODO(felt): implement this. |
| + return "hi"; |
| +} |
| + |
| +std::string ManagerAction::PrettyPrintForDebug() { |
| + // TODO(felt): implement this. |
| + return "hi"; |
| +} |
| + |
| +std::string ManagerAction::VerbAsString() { |
| + switch (verb_) { |
|
mvrable
2012/12/04 01:00:13
The identation for the switch statement is correct
felt
2012/12/07 19:27:45
Done.
|
| + case READ: |
| + return "READ"; |
| + case MODIFIED: |
| + return "MODIFIED"; |
| + case DELETED: |
| + return "DELETED"; |
| + case ADDED: |
| + return "ADDED"; |
| + case ENABLED: |
| + return "ENABLED"; |
| + case DISABLED: |
| + return "DISABLED"; |
| + case CREATED: |
| + return "CREATED"; |
| + default: |
| + return "UNKNOWN_ACTION"; |
| + } |
| +} |
| + |
| +std::string ManagerAction::TargetAsString() { |
| + switch (target_) { |
| + case BOOKMARK: |
| + return "BOOKMARK"; |
| + case TABS: |
| + return "TABS"; |
| + case HISTORY: |
| + return "HISTORY"; |
| + case COOKIES: |
| + return "COOKIES"; |
| + case BROWSER_ACTION: |
| + return "BROWSER_ACTION"; |
| + case NOTIFICATION: |
| + return "NOTIFICATION"; |
| + case OMNIBOX: |
| + return "OMNIBOX"; |
| + default: |
| + return "UNKNOWN_TARGET"; |
| + } |
| +} |
| + |
| +ManagerAction::ManagerActionType ManagerAction::StringAsManagerActionType( |
| + const std::string& str) { |
| + if (str == "READ") { |
| + return READ; |
| + } else if (str == "MODIFIED") { |
| + return MODIFIED; |
| + } else if (str == "DELETED") { |
| + return DELETED; |
| + } else if (str == "ADDED") { |
| + return ADDED; |
| + } else if (str == "ENABLED") { |
| + return ENABLED; |
| + } else if (str == "DISABLED") { |
| + return DISABLED; |
| + } else if (str == "CREATED") { |
| + return CREATED; |
| + } else { |
| + return UNKNOWN_ACTION; |
| + } |
| +} |
| + |
| +ManagerAction::ManagerTargetType ManagerAction::StringAsManagerTargetType( |
| + const std::string& str) { |
| + if (str == "BOOKMARK") { |
| + return BOOKMARK; |
| + } else if (str == "TABS") { |
| + return TABS; |
| + } else if (str == "HISTORY") { |
| + return HISTORY; |
| + } else if (str == "COOKIES") { |
| + return COOKIES; |
| + } else if (str == "BROWSER_ACTION") { |
| + return BROWSER_ACTION; |
| + } else if (str == "NOTIFICATION") { |
| + return NOTIFICATION; |
| + } else if (str == "OMNIBOX") { |
| + return OMNIBOX; |
| + } else { |
| + return UNKNOWN_TARGET; |
| + } |
| +} |
| +} // namespace |