| 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/ui/webui/chromeos/login/network_dropdown.h" | 5 #include "chrome/browser/ui/webui/chromeos/login/network_dropdown.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/browser/chromeos/cros/cros_library.h" | 10 #include "chrome/browser/chromeos/cros/cros_library.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 for (int i = 0; i < model->GetItemCount(); ++i) { | 67 for (int i = 0; i < model->GetItemCount(); ++i) { |
| 68 ui::MenuModel::ItemType type = model->GetTypeAt(i); | 68 ui::MenuModel::ItemType type = model->GetTypeAt(i); |
| 69 int id; | 69 int id; |
| 70 if (type == ui::MenuModel::TYPE_SEPARATOR) | 70 if (type == ui::MenuModel::TYPE_SEPARATOR) |
| 71 id = -2; | 71 id = -2; |
| 72 else | 72 else |
| 73 id = model->GetCommandIdAt(i); | 73 id = model->GetCommandIdAt(i); |
| 74 base::DictionaryValue* item = new base::DictionaryValue(); | 74 base::DictionaryValue* item = new base::DictionaryValue(); |
| 75 item->SetInteger("id", id); | 75 item->SetInteger("id", id); |
| 76 item->SetString("label", model->GetLabelAt(i)); | 76 item->SetString("label", model->GetLabelAt(i)); |
| 77 SkBitmap icon; | 77 gfx::ImageSkia icon; |
| 78 if (model->GetIconAt(i, &icon)) | 78 if (model->GetIconAt(i, &icon)) |
| 79 item->SetString("icon", web_ui_util::GetImageDataUrl(icon)); | 79 item->SetString("icon", web_ui_util::GetImageDataUrl(icon)); |
| 80 if (id >= 0) { | 80 if (id >= 0) { |
| 81 item->SetBoolean("enabled", model->IsEnabledAt(i)); | 81 item->SetBoolean("enabled", model->IsEnabledAt(i)); |
| 82 const gfx::Font* font = model->GetLabelFontAt(i); | 82 const gfx::Font* font = model->GetLabelFontAt(i); |
| 83 if (font) { | 83 if (font) { |
| 84 item->SetBoolean("bold", font->GetStyle() == gfx::Font::BOLD); | 84 item->SetBoolean("bold", font->GetStyle() == gfx::Font::BOLD); |
| 85 } | 85 } |
| 86 } | 86 } |
| 87 if (type == ui::MenuModel::TYPE_SUBMENU) | 87 if (type == ui::MenuModel::TYPE_SUBMENU) |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 std::string icon_str = | 153 std::string icon_str = |
| 154 icon_bitmap.empty() ? | 154 icon_bitmap.empty() ? |
| 155 std::string() : web_ui_util::GetImageDataUrl(icon_bitmap); | 155 std::string() : web_ui_util::GetImageDataUrl(icon_bitmap); |
| 156 base::StringValue title(text); | 156 base::StringValue title(text); |
| 157 base::StringValue icon(icon_str); | 157 base::StringValue icon(icon_str); |
| 158 web_ui_->CallJavascriptFunction("cr.ui.DropDown.updateNetworkTitle", | 158 web_ui_->CallJavascriptFunction("cr.ui.DropDown.updateNetworkTitle", |
| 159 title, icon); | 159 title, icon); |
| 160 } | 160 } |
| 161 | 161 |
| 162 } // namespace chromeos | 162 } // namespace chromeos |
| OLD | NEW |