summaryrefslogtreecommitdiffstats
path: root/chrome/common/extensions/extension_action2.cc
blob: 653de950d5e5ab29876f4992681eb8c085b152dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/common/extensions/extension_action2.h"

#include "base/logging.h"

const int ExtensionAction2::kDefaultTabId = -1;

void ExtensionAction2::SetDefaultIcon(const std::string& path) {
  default_icon_path_ = path;
  icon_.erase(kDefaultTabId);
}

void ExtensionAction2::SetDefaultIcon(int icon_index) {
  if (static_cast<size_t>(icon_index) >= icon_paths_.size()) {
    NOTREACHED();
    return;
  }

  SetDefaultIcon(icon_paths_[icon_index]);
}

void ExtensionAction2::ClearAllValuesForTab(int tab_id) {
  title_.erase(tab_id);
  icon_.erase(tab_id);
  badge_text_.erase(tab_id);
  badge_background_color_.erase(tab_id);
  badge_text_color_.erase(tab_id);
}