| 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/extensions/extension_tabs_module.h" | 5 #include "chrome/browser/extensions/extension_tabs_module.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/base64.h" | 10 #include "base/base64.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 #include "content/public/browser/navigation_entry.h" | 54 #include "content/public/browser/navigation_entry.h" |
| 55 #include "content/public/browser/notification_details.h" | 55 #include "content/public/browser/notification_details.h" |
| 56 #include "content/public/browser/notification_source.h" | 56 #include "content/public/browser/notification_source.h" |
| 57 #include "content/public/browser/render_view_host.h" | 57 #include "content/public/browser/render_view_host.h" |
| 58 #include "content/public/browser/render_view_host_delegate.h" | 58 #include "content/public/browser/render_view_host_delegate.h" |
| 59 #include "content/public/browser/web_contents.h" | 59 #include "content/public/browser/web_contents.h" |
| 60 #include "content/public/browser/web_contents_view.h" | 60 #include "content/public/browser/web_contents_view.h" |
| 61 #include "skia/ext/image_operations.h" | 61 #include "skia/ext/image_operations.h" |
| 62 #include "skia/ext/platform_canvas.h" | 62 #include "skia/ext/platform_canvas.h" |
| 63 #include "third_party/skia/include/core/SkBitmap.h" | 63 #include "third_party/skia/include/core/SkBitmap.h" |
| 64 #include "ui/base/ui_base_types.h" |
| 64 #include "ui/gfx/codec/jpeg_codec.h" | 65 #include "ui/gfx/codec/jpeg_codec.h" |
| 65 #include "ui/gfx/codec/png_codec.h" | 66 #include "ui/gfx/codec/png_codec.h" |
| 66 | 67 |
| 67 #if defined(USE_ASH) | 68 #if defined(USE_ASH) |
| 68 #include "ash/ash_switches.h" | 69 #include "ash/ash_switches.h" |
| 69 #include "base/command_line.h" | 70 #include "base/command_line.h" |
| 70 #include "chrome/browser/ui/views/ash/panel_view_aura.h" | 71 #include "chrome/browser/ui/views/ash/panel_view_aura.h" |
| 71 #endif | 72 #endif |
| 72 | 73 |
| 73 namespace Get = extensions::api::windows::Get; | 74 namespace Get = extensions::api::windows::Get; |
| (...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 web_app::GenerateApplicationNameFromExtensionId(extension_id); | 589 web_app::GenerateApplicationNameFromExtensionId(extension_id); |
| 589 PanelViewAura* panel_view = new PanelViewAura(title); | 590 PanelViewAura* panel_view = new PanelViewAura(title); |
| 590 panel_view->Init(window_profile, urls[0], panel_bounds); | 591 panel_view->Init(window_profile, urls[0], panel_bounds); |
| 591 result_.reset( | 592 result_.reset( |
| 592 panel_view->extension_window_controller()->CreateWindowValueWithTabs()); | 593 panel_view->extension_window_controller()->CreateWindowValueWithTabs()); |
| 593 return true; | 594 return true; |
| 594 } | 595 } |
| 595 #endif | 596 #endif |
| 596 | 597 |
| 597 // Create a new BrowserWindow. | 598 // Create a new BrowserWindow. |
| 598 Browser* new_window; | 599 Browser::CreateParams create_params; |
| 599 if (extension_id.empty()) { | 600 if (extension_id.empty()) { |
| 600 new_window = Browser::CreateForType(window_type, window_profile); | 601 create_params = Browser::CreateParams(window_type, window_profile); |
| 601 new_window->window()->SetBounds(window_bounds); | 602 create_params.initial_bounds = window_bounds; |
| 602 } else { | 603 } else { |
| 603 new_window = Browser::CreateForApp( | 604 create_params = Browser::CreateParams::CreateForApp( |
| 604 window_type, | 605 window_type, |
| 605 web_app::GenerateApplicationNameFromExtensionId(extension_id), | 606 web_app::GenerateApplicationNameFromExtensionId(extension_id), |
| 606 (window_type == Browser::TYPE_PANEL ? panel_bounds : popup_bounds), | 607 (window_type == Browser::TYPE_PANEL ? panel_bounds : popup_bounds), |
| 607 window_profile); | 608 window_profile); |
| 608 } | 609 } |
| 610 create_params.initial_show_state = ui::SHOW_STATE_NORMAL; |
| 611 Browser* new_window = Browser::CreateWithParams(create_params); |
| 612 |
| 609 for (std::vector<GURL>::iterator i = urls.begin(); i != urls.end(); ++i) { | 613 for (std::vector<GURL>::iterator i = urls.begin(); i != urls.end(); ++i) { |
| 610 TabContentsWrapper* tab = new_window->AddSelectedTabWithURL( | 614 TabContentsWrapper* tab = new_window->AddSelectedTabWithURL( |
| 611 *i, content::PAGE_TRANSITION_LINK); | 615 *i, content::PAGE_TRANSITION_LINK); |
| 612 if (window_type == Browser::TYPE_PANEL) | 616 if (window_type == Browser::TYPE_PANEL) |
| 613 tab->extension_tab_helper()->SetExtensionAppIconById(extension_id); | 617 tab->extension_tab_helper()->SetExtensionAppIconById(extension_id); |
| 614 } | 618 } |
| 615 if (contents) { | 619 if (contents) { |
| 616 TabStripModel* target_tab_strip = new_window->tabstrip_model(); | 620 TabStripModel* target_tab_strip = new_window->tabstrip_model(); |
| 617 target_tab_strip->InsertTabContentsAt(urls.size(), contents, | 621 target_tab_strip->InsertTabContentsAt(urls.size(), contents, |
| 618 TabStripModel::ADD_NONE); | 622 TabStripModel::ADD_NONE); |
| (...skipping 1199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1818 // called for every API call the extension made. | 1822 // called for every API call the extension made. |
| 1819 GotLanguage(language); | 1823 GotLanguage(language); |
| 1820 } | 1824 } |
| 1821 | 1825 |
| 1822 void DetectTabLanguageFunction::GotLanguage(const std::string& language) { | 1826 void DetectTabLanguageFunction::GotLanguage(const std::string& language) { |
| 1823 result_.reset(Value::CreateStringValue(language.c_str())); | 1827 result_.reset(Value::CreateStringValue(language.c_str())); |
| 1824 SendResponse(true); | 1828 SendResponse(true); |
| 1825 | 1829 |
| 1826 Release(); // Balanced in Run() | 1830 Release(); // Balanced in Run() |
| 1827 } | 1831 } |
| OLD | NEW |