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/bookmarks/bookmark_manager_extension_api.h" | 5 #include "chrome/browser/bookmarks/bookmark_manager_extension_api.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 if (!base::StringToInt64(id_string, &id)) | 51 if (!base::StringToInt64(id_string, &id)) |
52 return NULL; | 52 return NULL; |
53 return model->GetNodeByID(id); | 53 return model->GetNodeByID(id); |
54 } | 54 } |
55 | 55 |
56 // Gets a vector of bookmark nodes from the argument list of IDs. | 56 // Gets a vector of bookmark nodes from the argument list of IDs. |
57 // This returns false in the case of failure. | 57 // This returns false in the case of failure. |
58 bool GetNodesFromArguments(BookmarkModel* model, const ListValue* args, | 58 bool GetNodesFromArguments(BookmarkModel* model, const ListValue* args, |
59 size_t args_index, std::vector<const BookmarkNode*>* nodes) { | 59 size_t args_index, std::vector<const BookmarkNode*>* nodes) { |
60 | 60 |
61 ListValue* ids; | 61 const ListValue* ids; |
62 if (!args->GetList(args_index, &ids)) | 62 if (!args->GetList(args_index, &ids)) |
63 return false; | 63 return false; |
64 | 64 |
65 size_t count = ids->GetSize(); | 65 size_t count = ids->GetSize(); |
66 if (count == 0) | 66 if (count == 0) |
67 return false; | 67 return false; |
68 | 68 |
69 for (size_t i = 0; i < count; ++i) { | 69 for (size_t i = 0; i < count; ++i) { |
70 std::string id_string; | 70 std::string id_string; |
71 if (!ids->GetString(i, &id_string)) | 71 if (!ids->GetString(i, &id_string)) |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 bool can_open_new_windows = true; | 510 bool can_open_new_windows = true; |
511 | 511 |
512 #if defined(OS_WIN) | 512 #if defined(OS_WIN) |
513 if (base::win::IsMetroProcess()) | 513 if (base::win::IsMetroProcess()) |
514 can_open_new_windows = false; | 514 can_open_new_windows = false; |
515 #endif // OS_WIN | 515 #endif // OS_WIN |
516 | 516 |
517 SetResult(Value::CreateBooleanValue(can_open_new_windows)); | 517 SetResult(Value::CreateBooleanValue(can_open_new_windows)); |
518 return true; | 518 return true; |
519 } | 519 } |
OLD | NEW |