| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/wrench_menu_model.h" | 5 #include "chrome/browser/wrench_menu_model.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 WrenchMenuModel::~WrenchMenuModel() { | 68 WrenchMenuModel::~WrenchMenuModel() { |
| 69 } | 69 } |
| 70 | 70 |
| 71 static bool CalculateEnabled() { | 71 static bool CalculateEnabled() { |
| 72 CommandLine* cl = CommandLine::ForCurrentProcess(); | 72 CommandLine* cl = CommandLine::ForCurrentProcess(); |
| 73 if (cl->HasSwitch(switches::kNewWrenchMenu)) { | 73 if (cl->HasSwitch(switches::kNewWrenchMenu)) { |
| 74 // Honor the switch if present. | 74 // Honor the switch if present. |
| 75 std::string value = cl->GetSwitchValueASCII(switches::kNewWrenchMenu); | 75 std::string value = cl->GetSwitchValueASCII(switches::kNewWrenchMenu); |
| 76 return value.empty() || value == "true"; | 76 return value.empty() || value == "true"; |
| 77 } | 77 } |
| 78 #if defined(TOOLKIT_VIEWS) |
| 79 return true; |
| 80 #else |
| 78 return false; | 81 return false; |
| 82 #endif |
| 79 } | 83 } |
| 80 | 84 |
| 81 // static | 85 // static |
| 82 bool WrenchMenuModel::IsEnabled() { | 86 bool WrenchMenuModel::IsEnabled() { |
| 83 static bool checked = false; | 87 static bool checked = false; |
| 84 static bool enabled = false; | 88 static bool enabled = false; |
| 85 if (!checked) { | 89 if (!checked) { |
| 86 checked = true; | 90 checked = true; |
| 87 enabled = CalculateEnabled(); | 91 enabled = CalculateEnabled(); |
| 88 } | 92 } |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 } | 200 } |
| 197 return l10n_util::GetStringFUTF16( | 201 return l10n_util::GetStringFUTF16( |
| 198 IDS_ABOUT, l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); | 202 IDS_ABOUT, l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); |
| 199 } | 203 } |
| 200 | 204 |
| 201 bool WrenchMenuModel::IsDynamicItem(int index) const { | 205 bool WrenchMenuModel::IsDynamicItem(int index) const { |
| 202 int command_id = GetCommandIdAt(index); | 206 int command_id = GetCommandIdAt(index); |
| 203 return command_id == IDC_SYNC_BOOKMARKS || | 207 return command_id == IDC_SYNC_BOOKMARKS || |
| 204 command_id == IDC_ABOUT; | 208 command_id == IDC_ABOUT; |
| 205 } | 209 } |
| OLD | NEW |