| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Implements the Chrome Extensions WebNavigation API. | 5 // Implements the Chrome Extensions WebNavigation API. |
| 6 | 6 |
| 7 #include "chrome/browser/extensions/extension_webnavigation_api.h" | 7 #include "chrome/browser/extensions/extension_webnavigation_api.h" |
| 8 | 8 |
| 9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 DictionaryValue* details; | 592 DictionaryValue* details; |
| 593 EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(0, &details)); | 593 EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(0, &details)); |
| 594 DCHECK(details); | 594 DCHECK(details); |
| 595 | 595 |
| 596 int tab_id; | 596 int tab_id; |
| 597 int frame_id; | 597 int frame_id; |
| 598 EXTENSION_FUNCTION_VALIDATE(details->GetInteger(keys::kTabIdKey, &tab_id)); | 598 EXTENSION_FUNCTION_VALIDATE(details->GetInteger(keys::kTabIdKey, &tab_id)); |
| 599 EXTENSION_FUNCTION_VALIDATE( | 599 EXTENSION_FUNCTION_VALIDATE( |
| 600 details->GetInteger(keys::kFrameIdKey, &frame_id)); | 600 details->GetInteger(keys::kFrameIdKey, &frame_id)); |
| 601 | 601 |
| 602 result_.reset(Value::CreateNullValue()); | 602 result_.reset(base::NullValue()); |
| 603 | 603 |
| 604 TabContentsWrapper* wrapper; | 604 TabContentsWrapper* wrapper; |
| 605 if (!ExtensionTabUtil::GetTabById( | 605 if (!ExtensionTabUtil::GetTabById( |
| 606 tab_id, profile(), include_incognito(), NULL, NULL, &wrapper, NULL) || | 606 tab_id, profile(), include_incognito(), NULL, NULL, &wrapper, NULL) || |
| 607 !wrapper) { | 607 !wrapper) { |
| 608 return true; | 608 return true; |
| 609 } | 609 } |
| 610 | 610 |
| 611 TabContents* tab_contents = wrapper->tab_contents(); | 611 TabContents* tab_contents = wrapper->tab_contents(); |
| 612 ExtensionWebNavigationTabObserver* observer = | 612 ExtensionWebNavigationTabObserver* observer = |
| (...skipping 11 matching lines...) Expand all Loading... |
| 624 DictionaryValue* resultDict = new DictionaryValue(); | 624 DictionaryValue* resultDict = new DictionaryValue(); |
| 625 resultDict->SetString( | 625 resultDict->SetString( |
| 626 keys::kUrlKey, | 626 keys::kUrlKey, |
| 627 frame_navigation_state.GetUrl(frame_id).spec()); | 627 frame_navigation_state.GetUrl(frame_id).spec()); |
| 628 resultDict->SetBoolean( | 628 resultDict->SetBoolean( |
| 629 keys::kErrorOccurredKey, | 629 keys::kErrorOccurredKey, |
| 630 frame_navigation_state.GetErrorOccurredInFrame(frame_id)); | 630 frame_navigation_state.GetErrorOccurredInFrame(frame_id)); |
| 631 result_.reset(resultDict); | 631 result_.reset(resultDict); |
| 632 return true; | 632 return true; |
| 633 } | 633 } |
| OLD | NEW |