Skip to content

Commit

Permalink
Revert "Remove SB14 code" (#3956)
Browse files Browse the repository at this point in the history
b/355449840

Reverts #3902
  • Loading branch information
madhurajayaraman authored Aug 9, 2024
1 parent c284ff6 commit a075f8b
Show file tree
Hide file tree
Showing 88 changed files with 921 additions and 16 deletions.
4 changes: 4 additions & 0 deletions cobalt/browser/user_agent_platform_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,11 @@ void InitializeUserAgentPlatformInfoFields(UserAgentPlatformInfo& info) {
info.set_original_design_manufacturer(input.second);
LOG(INFO) << "Set original design manufacturer to " << input.second;
} else if (!input.first.compare("device_type")) {
#if SB_API_VERSION < 15
info.set_device_type(GetDeviceType(input.second));
#else
info.set_device_type(input.second);
#endif
LOG(INFO) << "Set device type to " << input.second;
} else if (!input.first.compare("chipset_model_number")) {
info.set_chipset_model_number(input.second);
Expand Down
4 changes: 4 additions & 0 deletions cobalt/dom/html_media_element.cc
Original file line number Diff line number Diff line change
Expand Up @@ -706,12 +706,16 @@ void HTMLMediaElement::ScheduleEvent(const scoped_refptr<web::Event>& event) {
}

std::string HTMLMediaElement::h5vcc_audio_connectors() const {
#if SB_API_VERSION >= 15
if (!player_) {
return "";
}

std::vector<std::string> configs = player_->GetAudioConnectors();
return base::JoinString(configs, ";");
#else // SB_API_VERSION >= 15
return "";
#endif // SB_API_VERSION >= 15
}

void HTMLMediaElement::CreateMediaPlayer() {
Expand Down
2 changes: 2 additions & 0 deletions cobalt/dom/keyboard_event.cc
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,10 @@ std::string KeyboardEvent::NonPrintableKey(int32_t key_code) const {
return "MediaStop";
case keycode::kMediaPlayPause:
return "MediaPlayPause";
#if SB_API_VERSION >= 15
case keycode::kMediaRecord:
return "MediaRecord";
#endif
case keycode::kMediaLaunchMail:
return "LaunchMail";
case keycode::kMediaLaunchMediaSelect:
Expand Down
2 changes: 2 additions & 0 deletions cobalt/dom/keyboard_event_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,14 @@ TEST_F(KeyboardEventTest, CanGetKeyIdentifierAndKeyAndCode) {
EXPECT_EQ(keyboard_event_space->key(), " ");
EXPECT_EQ(keyboard_event_space->code(), "Space");

#if SB_API_VERSION >= 15
init.set_key_code(keycode::kMediaRecord);
scoped_refptr<KeyboardEvent> keyboard_event_record =
new KeyboardEvent("keydown", init);
EXPECT_EQ(keyboard_event_record->key_identifier(), "MediaRecord");
EXPECT_EQ(keyboard_event_record->key(), "MediaRecord");
EXPECT_EQ(keyboard_event_record->code(), "MediaRecord");
#endif
}

TEST_F(KeyboardEventTest, CanGetAltKey) {
Expand Down
2 changes: 2 additions & 0 deletions cobalt/dom/keycode.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,9 @@ enum {
// Not present in Windows virtual key codes, but would be used by the client.
kMediaRewind = 0xE3,
kMediaFastForward = 0xE4,
#if SB_API_VERSION >= 15
kMediaRecord = 0x1A0,
#endif
};

} // namespace keycode
Expand Down
24 changes: 24 additions & 0 deletions cobalt/extension/configuration.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright 2023 The Cobalt Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef COBALT_EXTENSION_CONFIGURATION_H_
#define COBALT_EXTENSION_CONFIGURATION_H_

#if SB_API_VERSION <= 14
#include "starboard/extension/configuration.h"
#else
#error "Extensions have moved, please see CHANGELOG for details."
#endif

#endif // COBALT_EXTENSION_CONFIGURATION_H_
24 changes: 24 additions & 0 deletions cobalt/extension/crash_handler.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright 2023 The Cobalt Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef COBALT_EXTENSION_CRASH_HANDLER_H_
#define COBALT_EXTENSION_CRASH_HANDLER_H_

#if SB_API_VERSION <= 14
#include "starboard/extension/crash_handler.h"
#else
#error "Extensions have moved, please see Starboard CHANGELOG for details."
#endif

#endif // COBALT_EXTENSION_CRASH_HANDLER_H_
24 changes: 24 additions & 0 deletions cobalt/extension/demuxer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright 2023 The Cobalt Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef COBALT_EXTENSION_DEMUXER_H_
#define COBALT_EXTENSION_DEMUXER_H_

#if SB_API_VERSION <= 14
#include "starboard/extension/demuxer.h"
#else
#error "Extensions have moved, please see Starboard CHANGELOG for details."
#endif

#endif // COBALT_EXTENSION_DEMUXER_H_
24 changes: 24 additions & 0 deletions cobalt/extension/font.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright 2023 The Cobalt Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef COBALT_EXTENSION_FONT_H_
#define COBALT_EXTENSION_FONT_H_

#if SB_API_VERSION <= 14
#include "starboard/extension/font.h"
#else
#error "Extensions have moved, please see Starboard CHANGELOG for details."
#endif

#endif // COBALT_EXTENSION_FONT_H_
24 changes: 24 additions & 0 deletions cobalt/extension/free_space.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright 2023 The Cobalt Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef COBALT_EXTENSION_FREE_SPACE_H_
#define COBALT_EXTENSION_FREE_SPACE_H_

#if SB_API_VERSION <= 14
#include "starboard/extension/free_space.h"
#else
#error "Extensions have moved, please see Starboard CHANGELOG for details."
#endif

#endif // COBALT_EXTENSION_FREE_SPACE_H_
24 changes: 24 additions & 0 deletions cobalt/extension/graphics.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright 2023 The Cobalt Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef COBALT_EXTENSION_GRAPHICS_H_
#define COBALT_EXTENSION_GRAPHICS_H_

#if SB_API_VERSION <= 14
#include "starboard/extension/graphics.h"
#else
#error "Extensions have moved, please see Starboard CHANGELOG for details."
#endif

#endif // COBALT_EXTENSION_GRAPHICS_H_
24 changes: 24 additions & 0 deletions cobalt/extension/installation_manager.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright 2023 The Cobalt Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef COBALT_EXTENSION_INSTALLATION_MANAGER_H_
#define COBALT_EXTENSION_INSTALLATION_MANAGER_H_

#if SB_API_VERSION <= 14
#include "starboard/extension/installation_manager.h"
#else
#error "Extensions have moved, please see Starboard CHANGELOG for details."
#endif

#endif // COBALT_EXTENSION_INSTALLATION_MANAGER_H_
24 changes: 24 additions & 0 deletions cobalt/extension/javascript_cache.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright 2023 The Cobalt Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef COBALT_EXTENSION_JAVASCRIPT_CACHE_H_
#define COBALT_EXTENSION_JAVASCRIPT_CACHE_H_

#if SB_API_VERSION <= 14
#include "starboard/extension/javascript_cache.h"
#else
#error "Extensions have moved, please see Starboard CHANGELOG for details."
#endif

#endif // COBALT_EXTENSION_JAVASCRIPT_CACHE_H_
24 changes: 24 additions & 0 deletions cobalt/extension/media_session.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright 2023 The Cobalt Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef COBALT_EXTENSION_MEDIA_SESSION_H_
#define COBALT_EXTENSION_MEDIA_SESSION_H_

#if SB_API_VERSION <= 14
#include "starboard/extension/media_session.h"
#else
#error "Extensions have moved, please see Starboard CHANGELOG for details."
#endif

#endif // COBALT_EXTENSION_MEDIA_SESSION_H_
24 changes: 24 additions & 0 deletions cobalt/extension/memory_mapped_file.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright 2023 The Cobalt Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef COBALT_EXTENSION_MEMORY_MAPPED_FILE_H_
#define COBALT_EXTENSION_MEMORY_MAPPED_FILE_H_

#if SB_API_VERSION <= 14
#include "starboard/extension/memory_mapped_file.h"
#else
#error "Extensions have moved, please see Starboard CHANGELOG for details."
#endif

#endif // COBALT_EXTENSION_MEMORY_MAPPED_FILE_H_
24 changes: 24 additions & 0 deletions cobalt/extension/platform_service.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright 2023 The Cobalt Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef COBALT_EXTENSION_PLATFORM_SERVICE_H_
#define COBALT_EXTENSION_PLATFORM_SERVICE_H_

#if SB_API_VERSION <= 14
#include "starboard/extension/platform_service.h"
#else
#error "Extensions have moved, please see Starboard CHANGELOG for details."
#endif

#endif // COBALT_EXTENSION_PLATFORM_SERVICE_H_
24 changes: 24 additions & 0 deletions cobalt/extension/updater_notification.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright 2023 The Cobalt Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef COBALT_EXTENSION_UPDATER_NOTIFICATION_H_
#define COBALT_EXTENSION_UPDATER_NOTIFICATION_H_

#if SB_API_VERSION <= 14
#include "starboard/extension/updater_notification.h"
#else
#error "Extensions have moved, please see Starboard CHANGELOG for details."
#endif

#endif // COBALT_EXTENSION_UPDATER_NOTIFICATION_H_
24 changes: 24 additions & 0 deletions cobalt/extension/url_fetcher_observer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright 2023 The Cobalt Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef COBALT_EXTENSION_URL_FETCHER_OBSERVER_H_
#define COBALT_EXTENSION_URL_FETCHER_OBSERVER_H_

#if SB_API_VERSION <= 14
#include "starboard/extension/url_fetcher_observer.h"
#else
#error "Extensions have moved, please see Starboard CHANGELOG for details."
#endif

#endif // COBALT_EXTENSION_URL_FETCHER_OBSERVER_H_
Loading

0 comments on commit a075f8b

Please sign in to comment.